PostCSS plugin to transform :matches() W3C CSS pseudo class to more compatible CSS (simpler selectors)
JavaScript
Latest commit 126391f Sep 13, 2016 @MoOx MoOx 2.0.5
Permalink
Failed to load latest commit information.
src Fixed: Don't mangle selector parts that don't contain `:matches` (#13) Sep 13, 2016
test
.babelrc Fixed: .class:matches(element) now produce element.class (#8) Sep 6, 2016
.editorconfig
.eslintignore Initial release Apr 30, 2015
.eslintrc Fixed: .class:matches(element) now produce element.class (#8) Sep 6, 2016
.gitignore
.travis.yml
CHANGELOG.md 2.0.5 Sep 13, 2016
LICENSE Initial release Apr 30, 2015
README.md
package.json

README.md

postcss-selector-matches Build Status

PostCSS plugin to transform :matches() W3C CSS pseudo class to more compatible CSS selectors

http://dev.w3.org/csswg/selectors-4/#matches

Installation

$ npm install postcss-selector-matches

Usage

var postcss = require("postcss")

var output = postcss()
  .use(require("postcss-selector-matches"))
  .process(require("fs").readFileSync("input.css", "utf8"))
  .css

Using this input.css:

p:matches(:first-child, .special) {
  color: red;
}

you will get:

p:first-child, p.special {
  color: red;
}

Note that if you are doing crazy selector like p:matches(a) {} you are likely to get crazy results (like pa {}).

Options

lineBreak

(default: false)

Allows you to introduce a line break between generated selectors.


Changelog

License