Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
postcss-minify-selectors
Advanced tools
The postcss-minify-selectors package is a PostCSS plugin that minifies CSS selectors. It helps in reducing the size of CSS files by removing unnecessary spaces and characters from selectors, which can improve the performance of web pages.
Minify Selectors
This feature minifies CSS selectors by removing unnecessary spaces and characters. In the example, the selectors '.foo, .bar' are minified to '.foo,.bar'.
const postcss = require('postcss');
const minifySelectors = require('postcss-minify-selectors');
const css = '.foo, .bar { color: red; }';
postcss([minifySelectors])
.process(css)
.then(result => {
console.log(result.css); // Output: '.foo,.bar{color:red;}'
});
Remove Redundant Selectors
This feature removes redundant selectors. In the example, the redundant '.foo' selector is removed, resulting in a cleaner and smaller CSS file.
const postcss = require('postcss');
const minifySelectors = require('postcss-minify-selectors');
const css = '.foo, .foo { color: red; }';
postcss([minifySelectors])
.process(css)
.then(result => {
console.log(result.css); // Output: '.foo{color:red;}'
});
cssnano is a modular minifier based on the PostCSS ecosystem. It includes a variety of optimizations, including selector minification, which makes it a more comprehensive tool compared to postcss-minify-selectors.
clean-css is a fast and efficient CSS optimizer for Node.js. It provides a wide range of optimizations, including selector minification, similar to postcss-minify-selectors, but also offers additional features like advanced optimizations and compatibility options.
csso (CSS Optimizer) is a CSS minifier that performs structural optimizations to make CSS files smaller. It includes selector minification as one of its features, making it comparable to postcss-minify-selectors, but it also focuses on other types of optimizations.
Minify selectors with PostCSS.
With npm do:
npm install postcss-minify-selectors --save
h1 + p, h2, h3, h2{color:blue}
h1+p,h2,h3{color:blue}
For more examples see the tests.
See the PostCSS documentation for examples for your environment.
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs
FAQs
Minify selectors with PostCSS.
The npm package postcss-minify-selectors receives a total of 7,362,074 weekly downloads. As such, postcss-minify-selectors popularity was classified as popular.
We found that postcss-minify-selectors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.