postcss-times

1.0.0 • Public • Published

postcss-times

npm version Build Status XO code style

PostCSS plugin that to use instead of !important


Install

npm i postcss-times

Usage

Write css.

#id:times(2) {}
.class:times(3) {}
.parent .child:times(2) {}
.parent .child.multi:times(2) {}
[attr=class]:times(2) {}
[attr^=class]:times(2) {}
[attr$=class]:times(2) {}
[attr="class"]:times(2) {}

#id:times(str) {}

Transform

const fs = require('fs');
const postcss = require('postcss');
const times = require('postcss-times');

const css = fs.readFileSync('./sample.css', 'utf-8');

postcss([times])
  .process(css)
  .then(result => console.log(result.css));

Output

Get like this.

#id#id {}
.class.class.class {}
.parent .child.child {}
.parent .child.multi.multi {}
[attr=class][attr=class] {}
[attr^=class][attr^=class] {}
[attr$=class][attr$=class] {}
[attr="class"][attr="class"] {}

#id {}

Run to example

1 Clone this

git clone git@github.com:totora0155/postcss-times.git

2 Change directory

cd postcss-times

3 Install modules

npm install

4 Run to script

cd examples && node postcss.js

Change log

version log
1.0.0 Rewrite es6
0.0.1 Release!

Package Sidebar

Install

npm i postcss-times

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • nju33