2.0.2 • Published 8 years ago
bundle-cssify v2.0.2
bundle-cssify
superseded by css-extract
browserify transform to extract css for insert-css
into external css files
what?
given a file like
// entry.js
var insertCss = require('insert-css')
insertCss('h1 {\n text-align: center;\n}')
console.log("rainbows and sunshine")
transform into
// bundle.js
console.log("rainbows and sunshine")
and
/* css/86bffed652227c2fc7321a8a.css */
h1 {
text-align: center;
}
where each extracted css file will be named by the hash of its content.
install
with npm
:
npm install --save bundle-cssify
usage
cli
as a normal browserify transform:
browserify entry.js -t [ bundle-cssify -d ./css ] > bundle.js
replace -t
with -g
to run as a global transform (where "the transform will operate on ALL files, despite whether they exist up a level in a node_modules/
directory")
package.json
as a normal browserify transform:
{
"scripts": {
"build": "browserify entry.js > bundle.js"
},
"browserify": {
"transform": [
["bundle-cssify", { "directory": "./css" } ]
]
}
}