[Request] Publish assets on NPM for use with Webpacker
Fs00 opened this issue ยท 9 comments
Hello!
Could you publish an NPM package containing gem assets (CSS, fonts) so that they can be used together with Webpacker?
Currently we need to copy all the assets in our codebase in order to use Webpacker, which is not great for obvious reasons.
Also, in the future ActiveAdmin will adopt Webpacker by default (see activeadmin/activeadmin#6781 (comment)).
Thanks!
Hi @Fs00!
Thanks for the issue.
I have just added a basic Webpacker support in master branch.
You can follow the install instructions in the README.
At the moment, I prefer to avoid keeping a version of the package also in NPM - but as described - you can install the JS package directly from Github.
For now I disabled the icomoon font inclusion, because I'll need to make some extra check to include the font via JS.
But I was already planning to remove it replacing (possibly) with SVG icons (because I use only 3 icons in the index pages).
Please let me know if you make some tests.
Great, thank you! Will let you know when I try it.
Hi @Fs00.
Did you have a chance to make a try?
I have just prepared a release with Webpacker support and with some updates to the install instructions in the README.
Not yet, will try in the next days.
Tested locally and everything seems to work nicely! (except the known issue of missing icons ofc)
The only (workaroundable) problem I encountered with this comes from not using NPM. We use this theme in an enterprise application which is built in an environment that isn't connected to the outside world, therefore all dependencies must be available on the company's internal mirrors.
Being able to leverage their internal NPM mirror to install and update this theme would make things much easier for us. As it is now, we would need to ask them to manually upload the package every time we want to update the theme, which wouldn't be optimal for several reasons.
Anyway, I will accept your decision whether you will upload it on NPM or not.
You have really done a good job with this project in the last weeks, I think that now it has reached a good starting point to be used with Webpacker. ๐
I see your point ๐ค
Is the gem available in a local path?
If yes, what about trying to add the package from there?
https://stackoverflow.com/questions/40102686/how-to-install-package-with-local-path-by-yarn-it-couldnt-find-package#answer-40116358
It would be a nice solution, but sadly wouldn't work in your scenario because of differences in the way we install gems in a local dev environment vs in the CI pipeline.
It would be a nice solution, but sadly wouldn't work in your scenario because of differences in the way we install gems in a local dev environment vs in the CI pipeline.
What about using a private mirror for packages?
Like this tool for NPM: https://github.com/local-npm/local-npm
And this guide for gems: https://guides.rubygems.org/run-your-own-gem-server
As I said above, the company has a private NPM mirror that we can use to upload the package. The only problem is that we don't have direct control over that mirror, so we must ask other people to upload the dependency for us (which is perfectly doable, it's only less practical than pulling in the package directly from the official NPM registry).
We will go this route if you choose not to upload the package on NPM, don't worry.
Looking forward to have working icons out-of-the-box on Webpacker now๐