
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
postcss-pseudo-classes
Advanced tools
PostCSS plugin to convert pseudo-classes to classes for testing purposes
PostCSS plugin to automatically add in companion classes where pseudo-selectors are used. This allows you to add the class name to force the styling of a pseudo-selector, which can be really helpful for testing or being able to concretely reach all style states.
This plugin is a port of rework-pseudo-classes written by Alex Sexton.
$ npm install postcss-pseudo-classes
var pseudoclasses = require('postcss-pseudo-classes')({
// default contains `:root`.
blacklist: [],
// (optional) create classes for a restricted list of selectors
// N.B. the colon (:) is optional
restrictTo: [':nth-child', 'hover'],
// default is `false`. If `true`, will output CSS
// with all combinations of pseudo styles/pseudo classes.
allCombinations: true,
// default is `true`. If `false`, will generate
// pseudo classes for `:before` and `:after`
preserveBeforeAfter: false
});
postcss([ pseudoclasses ])
.process(css)
.then(function (result) { console.log(result.css); });
.some-selector:hover {
text-decoration: underline;
}
yields
.some-selector:hover,
.some-selector.\:hover {
text-decoration: underline;
}
<button class="some-selector :hover">howdy</button>
:nth-child(5)
would look like .class.\:nth-child\(5\)
and can be used as a regular class: <button class=":nth-child(5)">howdy</button>
.:focus:hover
becomes .\:focus.\:hover
.$ npm test
(MIT)
FAQs
PostCSS plugin to convert pseudo-classes to classes for testing purposes
The npm package postcss-pseudo-classes receives a total of 14,132 weekly downloads. As such, postcss-pseudo-classes popularity was classified as popular.
We found that postcss-pseudo-classes 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.