css2jsobject-list-loader

0.0.2 • Public • Published

css2jsobject-list-loader

A Webpack loader to convert css to JavaScript object through a list file

Usage

You need a list file that tells paths to css files.

./csspaths

./style.css
./style2.css

The css files are regular css contents.

./style.css

.list { background-color: #ff00ff; }
#item { font-size: 10px; }

./style2.css

.list { background-color: red; display: block; }

You can get a JavaScript object whose properties and values are simply equivalent to css contents through css2jsobject-list-loader.

const stylesAsJsObject = require('css2jsobject-list!./csspaths');

and below is the result.

{
  ".list": {
    "background-color": "red",
    "display": "block"
  },
  "#item": {
    "font-size": "10px"
  }
}

Requirement

  • Node.js v6.3.0~

Package Sidebar

Install

npm i css2jsobject-list-loader

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • ygoto3