blocknotes / activeadmin_blaze_theme

A theme for Active Admin based on Blaze CSS 3.x
MIT License
46 stars 12 forks source link

[Request] Publish assets on NPM for use with Webpacker #7

Open Fs00 opened 3 years ago

Fs00 commented 3 years ago

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!

blocknotes commented 3 years ago

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.

Fs00 commented 3 years ago

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

blocknotes commented 3 years ago

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.

Fs00 commented 3 years ago

Not yet, will try in the next days.

Fs00 commented 3 years ago

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

blocknotes commented 3 years ago

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

Fs00 commented 3 years ago

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.

blocknotes commented 3 years ago

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

Fs00 commented 3 years ago

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😉