Socket
Socket
Sign inDemoInstall

postcss-minify-selectors

Package Overview
Dependencies
2
Maintainers
8
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-minify-selectors


Version published
Maintainers
8
Created

Package description

What is postcss-minify-selectors?

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.

What are postcss-minify-selectors's main functionalities?

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;}'
  });

Other packages similar to postcss-minify-selectors

Readme

Source

postcss-minify-selectors

Minify selectors with PostCSS.

Install

With npm do:

npm install postcss-minify-selectors --save

Example

Input

h1 + p, h2, h3, h2{color:blue}

Output

h1+p,h2,h3{color:blue}

For more examples see the tests.

Usage

See the PostCSS documentation for examples for your environment.

Contributors

See CONTRIBUTORS.md.

License

MIT © Ben Briggs

Keywords

FAQs

Last updated on 05 Jun 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc