transform-css-to-json
Webpack loader that loads CSS and emits it as JSON
Installation
Usage
Put transform-css-to-json in as a loader in webpack.config.js.
// in webpack.config.js
...
loaders: [{
test: /\.css$/,
loader: 'json!transform-css-to-json'
}]
Example
path/to/some.css
a {
prop: value;
}
b {
prop: other-value;
}
example.js
var css = require('path/to/some.css');
// or ES2015-style
import css from 'path/to/some.css';
//css is now equal to the following:
css == {
a: { prop: value },
b: { prop: other-value}
}