css-as-json-loader

0.2.2-wip.1 • Public • Published

css-as-json-loader

Dependency Status devDependency Status

Webpack loader that loads CSS and emits it as JSON

Installation

css-as-json-loader on NPM

Usage

Put css-as-json-loader in as a loader in webpack.config.js. This loader is best combined with json-loader, as this plugin itself does not output a valid javascript module.

// in webpack.config.js
...
loaders: [{
  test: /\.css$/,
  loader: 'json!css-as-json'
}]

Example

path/to/some.css

ab {
  prop: value;
}
@media screen {
  a {
    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 == {
  type: 'root',
  origin: {
    source: 'path/to/some.css',
 
  },
  nodes: []
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.2-wip.13latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.2-wip.13
0.2.11
0.2.01
0.1.31
0.1.01

Package Sidebar

Install

npm i css-as-json-loader

Weekly Downloads

7

Version

0.2.2-wip.1

License

MIT

Last publish

Collaborators

  • call-a3