Run this to set your project up with a simple Brunch config.
./bin/rails generate npm_pipeline:brunch
If you don't want to use the generator, here's what it does.
Set it up with
brunch
and some basic plugins.
npm init --yes
npm install --save-dev brunch javascript-brunch css-brunch auto-reload-brunch
See: sample package.json
Set it up to watch source files in
app/brunch
, then put built files intovendor/assets
.
Set it up to ignore Brunch's built files.
/node_modules
/vendor/assets/stylesheets/brunch
/vendor/assets/javascripts/brunch
Set it up to include Brunch's built files. This will load from
vendor/assets/stylesheets/brunch/app.css
, as built by Brunch.
/*
*= require brunch/app
*/
Set it up to include Brunch's built files. This will load from
vendor/assets/javascripts/brunch/app.js
, as built by Brunch.
//= require brunch/app
Put your source files into
app/brunch
. For instance:
-
app/brunch/example.css
* { color: blue }
-
app/brunch/example.js
alert('it works!')