
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
postcss-quantity-queries
Advanced tools
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
npm install postcss-quantity-queries --save-dev
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);
});
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;
}
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;
}
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;
}
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;
}
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 |
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.
postcss-quantity-queries is unlicensed.
[0.5.0] - 2017-05-07
FAQs
PostCSS plugin enabling quantity-queries
The npm package postcss-quantity-queries receives a total of 4,789 weekly downloads. As such, postcss-quantity-queries popularity was classified as popular.
We found that postcss-quantity-queries demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.