Skip to main content

Modern Webpack template on Rails 5.1

Rails • Asked by Jiri Prochazka

I have downloaded this Adminator template, which is modern npm/yarn Webpack theme. As stated in the template's homepage, install instructions are:

> git clone https://github.com/puikinsh/Adminator-admin-dashboard.git adminator
> cd adminator
> npm install
> npm run dev

And it is working like a charm.

Now my question is, how can I implement it to Rails 5.1+? Should I use webpack support when creating a new app:

> rails new myapp --webpack

Template contains a folder assets should that whole folder to app/javascript/pack and run npm install to install node_modules?

But those are not any components, I think it should be rather placed in /vendors folder, right?

Thank you


Hey Jiri,

I think you're right for the most part. I believe you could just move those assets folders into app/javascript/pack and you'd be able to use reference them from there.

You could probably put it in the vendor folder since you wouldn't really want to edit these files, but that may just require you to import the files into webpacker a bit differently.

You might have to say like import X from '../../vendor/assets/index or whatever. It'll take some experimenting.

I think the vendor folder is the ideal so you aren't tempted to edit any of those files to make updating to newer versions of the template easier. That said, don't let that stop you if you can get it working in app/javascript easier. A running app is more useful than a perfectly organized one. You can always move the files around after you get it working.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.