transform-css-to-json

1.0.0 • Public • Published

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

/transform-css-to-json/

    Package Sidebar

    Install

    npm i transform-css-to-json

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • thisiscreativ