node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

rework-only-child

Rework Only Child

Build Status

A rework implementation of the :only-child pseudo-class selector based off CSS Selectors Level 4.

This will convert the :only-child pseudo-class selector:

.some-class,
.some-other-class:only-child {
  color: blue;
}

To the currently compatible equivalent:

.some-class,
.some-other-class:first-child:last-child {
  color: blue;
}

Installation

npm install --save rework-only-child

Usage

var fs       = require('fs');
var rework   = require('rework');
var onlyChild = require('rework-only-child');
 
var css = fs.readFileSync('css/my-file.css', 'utf8').toString();
var out = rework(css).use(onlyChild()).toString();

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander (@4lpine).