Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | # postcss-selector-matches [![CSS Standard Status](https://cssdb.org/badge/matches-pseudo-class.svg)](https://cssdb.org/#matches-pseudo-class) [![Build Status](https://travis-ci.org/postcss/postcss-selector-matches.svg?branch=master)](https://travis-ci.org/postcss/postcss-selector-matches)
|
---|
| 2 |
|
---|
| 3 | > PostCSS plugin to transform `:matches()` W3C CSS pseudo class to more compatible CSS selectors
|
---|
| 4 |
|
---|
| 5 | http://dev.w3.org/csswg/selectors-4/#matches
|
---|
| 6 |
|
---|
| 7 | ## Installation
|
---|
| 8 |
|
---|
| 9 | ```console
|
---|
| 10 | $ npm install postcss-selector-matches
|
---|
| 11 | ```
|
---|
| 12 |
|
---|
| 13 | ## Usage
|
---|
| 14 |
|
---|
| 15 | ```js
|
---|
| 16 | var postcss = require("postcss")
|
---|
| 17 |
|
---|
| 18 | var output = postcss()
|
---|
| 19 | .use(require("postcss-selector-matches"))
|
---|
| 20 | .process(require("fs").readFileSync("input.css", "utf8"))
|
---|
| 21 | .css
|
---|
| 22 | ```
|
---|
| 23 |
|
---|
| 24 | Using this `input.css`:
|
---|
| 25 |
|
---|
| 26 | ```css
|
---|
| 27 | p:matches(:first-child, .special) {
|
---|
| 28 | color: red;
|
---|
| 29 | }
|
---|
| 30 | ```
|
---|
| 31 |
|
---|
| 32 | you will get:
|
---|
| 33 |
|
---|
| 34 | ```css
|
---|
| 35 | p:first-child, p.special {
|
---|
| 36 | color: red;
|
---|
| 37 | }
|
---|
| 38 | ```
|
---|
| 39 |
|
---|
| 40 | **Note that if you are doing crazy selector like `p:matches(a) {}` you are likely to get crazy results (like `pa {}`)**.
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | ## Options
|
---|
| 44 |
|
---|
| 45 | ### `lineBreak`
|
---|
| 46 |
|
---|
| 47 | (default: `false`)
|
---|
| 48 |
|
---|
| 49 | Allows you to introduce a line break between generated selectors.
|
---|
| 50 |
|
---|
| 51 | ---
|
---|
| 52 |
|
---|
| 53 | ## [Changelog](CHANGELOG.md)
|
---|
| 54 |
|
---|
| 55 | ## [License](LICENSE)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.