1.0.0 • Published 6 years ago

transform-css-to-json v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

transform-css-to-json

Dependency Status devDependency Status

Webpack loader that loads CSS and emits it as JSON

Installation

transform-css-to-json on NPM

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}
}