Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Latest commit

 

History

History
72 lines (46 loc) · 1.42 KB

brunch.md

File metadata and controls

72 lines (46 loc) · 1.42 KB

Brunch integration

Run this to set your project up with a simple Brunch config.

./bin/rails generate npm_pipeline:brunch

Manual setup

If you don't want to use the generator, here's what it does.

package.json

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

brunch-config.js

Set it up to watch source files in app/brunch, then put built files into vendor/assets.

See: sample brunch-config.js

.gitignore

Set it up to ignore Brunch's built files.

/node_modules
/vendor/assets/stylesheets/brunch
/vendor/assets/javascripts/brunch

app/assets/stylesheets/application.css

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
 */

app/assets/javascripts/application.js

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

app/brunch/

Put your source files into app/brunch. For instance:

  • app/brunch/example.css

    * { color: blue }
  • app/brunch/example.js

    alert('it works!')