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