Webpacker
Use Webpack to manage app-like Javascript modules in Rails
Webpacker
makes it easy to use the Javascript
pre-processor and bundler to manage application-like Javascript
in Rails
. It coexists with the asset pipeline, as the primary purpose for webpack
is app-like Javascript
, not images, CSS
, or even Javascript Sprinkles
(that all continues to live in app/assets).However, it is possible to use
Webpacker
for CSS
, images and fonts assets as well, in which case you may not even need the asset pipeline. This is mostly relevant when exclusively using component-based Javascript
frameworks.bundle install
bundle exec rails webpacker:install
yarn upgrade
yarn install
Once installed, you can start writing modern
ES6 Javascript
apps right away:app/frontend:
├── packs:
│ # only webpack entry files here
│ └── application.js
│ └── application.scss
└── components:
│ └── header.vue
└── icons:
│ └── euro.svg
└── stylesheets:
│ └── application.scss
│ └── tailwind.css
└── images:
└── placeholeder.jpg
./bin/webpack-dev-server
Last modified 2yr ago