You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

postcss-unique-selectors

Package Overview
Dependencies
Maintainers
8
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-unique-selectors

Ensure CSS selectors are unique.


Version published
Weekly downloads
11M
decreased by-1.28%
Maintainers
8
Install size
209 kB
Created
Weekly downloads
 

Package description

What is postcss-unique-selectors?

The postcss-unique-selectors npm package is a PostCSS plugin that removes duplicate CSS selectors within a rule. This helps in optimizing the CSS by ensuring that each selector is unique, which can reduce the size of the CSS file and improve maintainability.

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

Remove duplicate selectors

This feature removes duplicate selectors within a CSS rule. In the provided code sample, the duplicate 'a' selector is removed, resulting in 'a, b { color: red; }'.

const postcss = require('postcss');
const uniqueSelectors = require('postcss-unique-selectors');

const css = 'a, a, b { color: red; }';

postcss([uniqueSelectors])
  .process(css)
  .then(result => {
    console.log(result.css); // Output: 'a, b { color: red; }'
  });

Other packages similar to postcss-unique-selectors

Readme

Source

postcss-unique-selectors

Ensure CSS selectors are unique.

Install

With npm do:

npm install postcss-unique-selectors --save

Example

Selectors are sorted naturally, and deduplicated:

Input

h1,h3,h2,h1 {
    color: red
}

Output

h1,h2,h3 {
    color: red
}

Usage

See the PostCSS documentation for examples for your environment.

Contributors

See CONTRIBUTORS.md.

License

MIT © Ben Briggs

Keywords

FAQs

Package 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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc