Browserify middleware for adding required styles to the page.
Simple middleware and method for Browserify to add Sass styles to the browser.
Currently breaks in some cases on node 0.11.x with latest version (2.0.1) of node-sass as documented in node-sass issue #550. This is also the reason why node 0.11 is currently not supported. Use at your own risk (though no actual risk is involved, it might just not work).
If you have a file
entry.js that you want to require some css from
require'./style.scss';console.log'The background is pink!'
Or indented Sass syntax may be used with the
Install sassify into your app:
$ npm install sassify
When you compile your app, just pass
-t sassify to browserify:
$ browserify -t sassify entry.js > bundle.js
Sass allows one to
@import other Sass files. This module synchronously imports those dependencies at the time of the bundling. It looks for the imported files in both the directory of the parent file and the folder where the module itself lives, so it should work so long as the paths in the
@import commands are correct relative to the importing file, as usual. It is not currently tested for recursive importing.