activeadmin_blaze_theme icon indicating copy to clipboard operation
activeadmin_blaze_theme copied to clipboard

[Request] Publish assets on NPM for use with Webpacker

Open Fs00 opened this issue 4 years ago • 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 https://github.com/activeadmin/activeadmin/issues/6781#issuecomment-801842028).

Thanks!

Fs00 avatar May 04 '21 12:05 Fs00

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.

blocknotes avatar May 05 '21 07:05 blocknotes

Great, thank you! Will let you know when I try it.

Fs00 avatar May 05 '21 08:05 Fs00

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.

blocknotes avatar May 10 '21 08:05 blocknotes

Not yet, will try in the next days.

Fs00 avatar May 10 '21 15:05 Fs00

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. 👏

Fs00 avatar May 12 '21 13:05 Fs00

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

blocknotes avatar May 13 '21 20:05 blocknotes

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.

Fs00 avatar May 17 '21 11:05 Fs00

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

blocknotes avatar May 18 '21 06:05 blocknotes

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😉

Fs00 avatar May 18 '21 18:05 Fs00