CSS in JS via the CSSStylesheet API
This library takes a CSS string and outputs an Array of Strings that are consumable by the CSSStylesheet API
npm install --save cssrules
const cssrules = require('cssrules');
cssrules(`.myrule { color: red; }`)
.then(output => {
console.log(output);
});
const cssrules = require('cssrules');
const fs = require('fs');
const path = require('path');
const myCssFile = fs.readFileSync(path.resolve('./my_file.css', 'utf8'));
cssrules(myCssFile)
.then(output => {
console.log(output);
});
- webpack via cssrules-loader