pascalduez / Postcss Quantity Queries
Licence: unlicense
PostCSS plugin enabling quantity-queries
Stars: ✭ 113
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Postcss Quantity Queries
Css In React
🍭 CSS in React - Learn the best CSS in JS frameworks by example
Stars: ✭ 101 (-10.62%)
Mutual labels: postcss
Elm Batteries
Learn how Elm, Parcel, Cypress and Netlify work together. Get started with Elm navigation, routes, remote data and decoder.
Stars: ✭ 108 (-4.42%)
Mutual labels: postcss
Rtlcss
Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL)
Stars: ✭ 1,363 (+1106.19%)
Mutual labels: postcss
Postcss Pxtorem
Convert pixel units to rem (root em) units using PostCSS
Stars: ✭ 1,592 (+1308.85%)
Mutual labels: postcss
Postcss Foft Classes
A postcss plugin to automatically add classes for various font loading strategies.
Stars: ✭ 87 (-23.01%)
Mutual labels: postcss
Sapper Firebase Typescript Graphql Tailwindcss Actions Template
A template that includes Sapper for Svelte, Firebase functions and hosting, TypeScript and TypeGraphQL, Tailwind CSS, ESLint, and automatic building and deployment with GitHub Actions
Stars: ✭ 111 (-1.77%)
Mutual labels: postcss
Wordpressify
🎈 A build system designed to automate your WordPress development workflow.
Stars: ✭ 1,374 (+1115.93%)
Mutual labels: postcss
Tailwindcss
A utility-first CSS framework for rapid UI development.
Stars: ✭ 50,879 (+44925.66%)
Mutual labels: postcss
Shortstack
🥞 minimal Rollup + PostCSS modern syntax starter template
Stars: ✭ 94 (-16.81%)
Mutual labels: postcss
Gridsome Plugin Tailwindcss
A Tailwind plugin for Gridsome.
Stars: ✭ 100 (-11.5%)
Mutual labels: postcss
Postcss Font Family System Ui
PostCSS plugin to transform W3C CSS font-family: system-ui to a practical font-family list
Stars: ✭ 91 (-19.47%)
Mutual labels: postcss
Postcss High Contrast
Create high contrast version of your project with ease.
Stars: ✭ 108 (-4.42%)
Mutual labels: postcss
React Boilerplate
This project is deprecated. Please use CRA instead.
Stars: ✭ 88 (-22.12%)
Mutual labels: postcss
Postcss Instagram
📷 PostCSS plugin for using Instagram filters in CSS
Stars: ✭ 111 (-1.77%)
Mutual labels: postcss
Postcss Plugins
The "officially unofficial" consolidated list of PostCSS plugins in a ready-to-use package
Stars: ✭ 107 (-5.31%)
Mutual labels: postcss
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 = require('fs');
const postcss = require('postcss');
const quantityQueries = require('postcss-quantity-queries');
const input = fs.readFileSync('input.css', 'utf8');
postcss()
.use(quantityQueries)
.process(input)
.then(result => {
fs.writeFileSync('output.css', result.css);
});
API
at-least
Target count
items or more:
:at-least(count) { ... }
input:
ul > li:at-least(4) {
color: rebeccapurple;
}
output:
ul > li:nth-last-child(n+4),
ul > li:nth-last-child(n+4) ~ li {
color: rebeccapurple;
}
at-most
Target count
items or less:
:at-most(count) { ... }
input:
ul > li:at-most(4) {
color: rebeccapurple;
}
output:
ul > li:nth-last-child(-n+4):first-child,
ul > li:nth-last-child(-n+4):first-child ~ li {
color: rebeccapurple;
}
between
Target a range of items between start
and end
:
:between(start, end) { ... }
input:
ul > li:between(4, 6) {
color: rebeccapurple;
}
output:
ul > li:nth-last-child(n+4):nth-last-child(-n+6):first-child,
ul > li:nth-last-child(n+4):nth-last-child(-n+6):first-child ~ li {
color: rebeccapurple;
}
exactly
Target exactly count
items:
:exactly(count) { ... }
input:
ul > li:exactly(4) {
color: rebeccapurple;
}
output:
ul > li:nth-last-child(4):first-child,
ul > li:nth-last-child(4):first-child ~ li {
color: rebeccapurple;
}
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.
@at-least count [, selector] { ... }
@at-most count [, selector] { ... }
@between start end [, selector] { ... }
@exactly count [, selector] { ... }
ul > li {
@at-least 4 span {
color: rebeccapurple;
}
}
ul > li {
@between 4 6 {
color: rebeccapurple;
}
}
Check out the tests for more examples.
Credits
Licence
postcss-quantity-queries is unlicensed.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].