cheton / browserify-css

A Browserify transform for bundling, rebasing, inlining, and minifying CSS files.
http://cheton.github.io/browserify-css/
MIT License
144 stars 22 forks source link

Work on template literals, not just files #39

Closed drschwabe closed 8 years ago

drschwabe commented 8 years ago

Would be handy if we could do:

require(p { color:green }) and have browserify-css do it's thing just like it would do if this was a separate CSS file.

cheton commented 8 years ago

Hi @drschwabe,

You can do this in your code:

var styleText = `p { color: green }`;
require('browserify-css').createStyle(styleText);

browser.js: https://github.com/cheton/browserify-css/blob/master/browser.js#L24

package.json: https://github.com/cheton/browserify-css/blob/master/package.json#L6

drschwabe commented 8 years ago

Perfect!