Lack of interest Automatically copy contents of _files to styles/... or js/... for current development addon

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

Rasmus Vind

Well-known member
It feels bad to me that in order to use the _files directory for add-on development, I will need to manually copy its contents to my styles/whatever or js/whatever during development. I feel like it should work just like template development does, which is to check the filesystem for template changes, import them into the database and use them without me thinking about it. On page load, it would scan the folder for files, see which is newer and override from the _files folder to the external destination. I am not sure how you even envision this workflow to be. Copying a file manually between the two seems like a great source of false debugging when you don't understand how something is not fixed, etc.
 
Upvote 1
This suggestion has been closed. Votes are no longer accepted.
You can reference JS in your templates using a special syntax to have them served from your add-on directory during development:

HTML:
<xf:js addon="Vendor/AddOn" src="vendor/addon/file.js" min="1" />

Unfortunately there's nothing similar for images and such at present, but I typically use symbolic links as a work-around.
 
Thanks!

Yeah, that could work, but the problem is I would want check those symlinks into git. And my ideal is to only commit my src/addons/MyAddon to git, not all of XenForo.

I am in the progress of making a .gitignore that ignores all of XenForo except my stuff. Here is a snippet. It's a huge kludge.
Code:
# Ignore everything in www
/site/www/*

# Except _something_ in www/js
!/site/www/js
/site/www/js/*

# Except my addon things
!/site/www/js/medals
!/site/www/js/node-icons
!/site/www/js/repository
!/site/www/js/vindit-bbcode
!/site/www/js/vindit-ranks

# Except _something_ www/src
!/site/www/src
/site/www/src/*

# Except addons and stypes
!/site/www/src/addons
!/site/www/src/styles

# Ignore all add-ons except my things
/site/www/src/addons/*
!/site/www/src/addons/VindIT

# Ignore all designer styles except mine
/site/www/src/styles/*
!/site/www/src/styles/Reforged

It would be so ideal to just have the .git folder inside src/addons/MyAddon.
 
It would be so ideal to just have the .git folder inside src/addons/MyAddon.
I'm not sure if there's something specific to your workflow that prevents this, but for what it's worth I do typically have one repository per add-on and simply clone the repository into the add-on's vendor folder. The symbolic link exists both in my development and production environments, but outside the purview of git.

It is possible to check symbolic links into a repository, whether that means having a separate repository for your XF root or having a monorepo for your XF installation and all of your add-ons, but understandably that can be a bit cumbersome to set up and work with.

Nevertheless I do think this is a valid suggestion, I was just sharing a work-around.
 
Top Bottom