You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does anyone have any tips on how to distribute assets for an addon? I am developing an addon that needs some js and css on the frontend to work, I created frontend assets using vite but when used with the vite tag they only work for npm run build not dev
My response was:
You can either:
Build them manually before you tag a release and include them in the Git repository. Then, in your service provider, you can publish the files to the site's public/vendor directory.
A little more advanced way (which we do at Statamic, and I use for my addons), is to ignore committing assets to the repository, then building them as part of a GitHub Actions workflow used for releasing. Jason's built a package which'll then copy over the assets from the GitHub release into the site's vendor directory upon composer update.
It feels like we could do with some more detailed documentation around how addon developers should handle this.
The text was updated successfully, but these errors were encountered:
Hey Duncan thanks for this and for your help. Just to add my notes and possibly I could help with writing a draft if I get all my facts straight.
Building assets for the frontend and the backend is a bit more complex and just one or the other. If we assume that the dependencies can be the same, we can probably document how to have separate vite config files?
Also I am not 100% sure what is the recommended way to distribute them. For the Statamic form helper you've used a "normal" import, however that leaves cache busting to the dev. In some addons the frontend assets might change often. Maybe we need to document also how to include them using the Vite tag or something similar?
This question has just come up on Discord:
My response was:
It feels like we could do with some more detailed documentation around how addon developers should handle this.
The text was updated successfully, but these errors were encountered: