Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Fs00 opened this issue May 4, 2021 · 9 comments
Open

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

Fs00 opened this issue May 4, 2021 · 9 comments
Assignees

Comments

@Fs00
Copy link
Contributor

Fs00 commented May 4, 2021

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!

@blocknotes
Copy link
Owner

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
Copy link
Contributor Author

Fs00 commented May 5, 2021

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

@blocknotes blocknotes self-assigned this May 10, 2021
@blocknotes
Copy link
Owner

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
Copy link
Contributor Author

Fs00 commented May 10, 2021

Not yet, will try in the next days.

@Fs00
Copy link
Contributor Author

Fs00 commented May 12, 2021

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
Copy link
Owner

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
Copy link
Contributor Author

Fs00 commented May 17, 2021

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
Copy link
Owner

blocknotes commented May 18, 2021

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
Copy link
Contributor Author

Fs00 commented May 18, 2021

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😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants