Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
postcss-selector-matches
Advanced tools
PostCSS plugin to transform :matches() W3C CSS pseudo class to more compatible CSS selectors
The postcss-selector-matches package is a PostCSS plugin that transforms :matches() pseudo-class into a more compatible CSS selector. This allows developers to use the :matches() pseudo-class in their CSS, which can simplify complex selectors and improve readability.
Transform :matches() pseudo-class
This feature transforms the :matches() pseudo-class into a more compatible CSS selector. For example, the input CSS 'a:matches(.foo, .bar) { color: red; }' will be transformed into 'a.foo, a.bar { color: red; }'. This makes the CSS more compatible with browsers that do not support the :matches() pseudo-class.
const postcss = require('postcss');
const selectorMatches = require('postcss-selector-matches');
const css = 'a:matches(.foo, .bar) { color: red; }';
postcss([selectorMatches])
.process(css)
.then(result => {
console.log(result.css);
});
The postcss-nesting package allows you to nest your CSS selectors in a way that follows the CSS Nesting Module Level 3 specification. It is similar to postcss-selector-matches in that it helps to simplify and organize complex CSS selectors, but it focuses on nesting rather than the :matches() pseudo-class.
The postcss-custom-selectors package allows you to define custom selectors in your CSS. This can be used to create reusable selector patterns, similar to how :matches() can simplify complex selectors. However, it provides a different approach by allowing you to define and use custom selectors.
PostCSS plugin to transform
:matches()
W3C CSS pseudo class to more compatible CSS selectors
http://dev.w3.org/csswg/selectors-4/#matches
$ npm install postcss-selector-matches
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 {}
).
lineBreak
(default: false
)
Allows you to introduce a line break between generated selectors.
1.2.1 - 2015-07-14
FAQs
PostCSS plugin to transform :matches() W3C CSS pseudo class to more compatible CSS selectors
The npm package postcss-selector-matches receives a total of 1,376,167 weekly downloads. As such, postcss-selector-matches popularity was classified as popular.
We found that postcss-selector-matches demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.