postcss-quantity-queries
PostCSS plugin enabling quantity-queries.
This plugin is derived from the Sass Quantity Queries mixins by Daniel Guillan.
For informations about quantity queries check those resources:
Quantity Queries for CSS
Styling elements based on sibling count
Daniel’s demo on CodePen
Installation
npm install postcss-quantity-queries --save-dev
Usage
const fs = ;const postcss = ;const quantityQueries = ; const input = fs; ;
API
at-least
Target count
items or more:
)
input:
)
output:
at-most
Target count
items or less:
)
input:
)
output:
between
Target a range of items between start
and end
:
)
input:
)
output:
exactly
Target exactly count
items:
)
input:
)
output:
All pseudo-selector extensions
Selector | Description |
---|---|
# :at-least(count) { … } |
Target count items or more |
# :at-most(count) { … } |
Target count items or less |
# :between(start, end) { … } |
Target a range of items between start and end |
# :exactly(count) { … } |
Target exactly count items |
At-rule API
There is also an at-rule API available, similar to pre-processors.
Although it might get deprecated at some point.
The recommended API is the pseudo-selectors one.
@
@
@
@
} }
Check out the tests for more examples.
Credits
Licence
postcss-quantity-queries is unlicensed.