Browserify plugin to extract scope-styles css into an external bundle
browserify -p [ scope-styles-extractify -o dist/main.css -e js ] index.js
Write to file:
var browserify = require('browserify');
var extractify = require('scoped-styles-extractify');
var b = browserify('./main.js');
b.plugin(extractify, {output: './dist/scoped.css'});
b.bundle();
Or grab output stream:
var fs = require('fs');
var browserify = require('browserify');
var extractify = require('scoped-styles-extractify');
var b = browserify('./main.js');
b.plugin(extractify);
var bundle = b.bundle();
bundle.on('scoped_css_stream', function (css) {
css.pipe(fs.createWriteStream('scoped.css'));
});