gulp-sprockets
gulp-sprockets is a NodeJS implementation of Sprockets.
It is able to build and precompile assets of Rails apps solely with Node.js, without Rails.
gulp-sprockets interprets Sprockets directives to concatenate asset files.
And you no longer need to hit the command rake assets:precompile
.
Provided gulp streams
sprockets.css
provides things of asset pipeline for CSS/SCSS/Sass.sprockets.js
provides things of asset pipeline for JavaScript/CoffeeScript.sprockets.precompile
provides things of asset precompiling.
Installation
npm install gulp-sprockets
Usage
gulpfile.babel.js
;;; const $ = ;const assetsPaths = app: "./app/assets" javascripts: stylesheets: images: ;const destPath = "./public/assets";const release = processenvNODE_ENV === 'release' // initialize sprockets!$sprocketsdeclareassetsPaths destPath; /** * Sprockets way */ gulp; gulp; gulp; gulp
package.json
{
"scripts": {
"build": "gulp"
},
...
}
And then do build command.
$ npm run build