Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-merge-rules

Package Overview
Dependencies
Maintainers
8
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-merge-rules

Merge CSS rules with PostCSS.

  • 6.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
8
Created

What is postcss-merge-rules?

The postcss-merge-rules npm package is designed to optimize CSS by merging CSS rules with identical selectors or declarations. This can lead to smaller CSS files and potentially faster load times for web pages.

What are postcss-merge-rules's main functionalities?

Merging based on identical selectors

This feature combines rules with identical selectors into a single rule. In the code sample, two rules for the 'a' selector are merged into one.

const postcss = require('postcss');
const mergeRules = require('postcss-merge-rules');

const css = `a { color: blue; }
a { font-size: 14px; }`;

postcss([mergeRules()])
.process(css, { from: undefined })
.then(result => console.log(result.css));

Merging based on identical declarations

This feature merges rules that have identical declarations but different selectors, creating a grouped selector. The code sample demonstrates merging two rules that apply the same color declaration to different selectors.

const postcss = require('postcss');
const mergeRules = require('postcss-merge-rules');

const css = `a { color: blue; }
b { color: blue; }`;

postcss([mergeRules()])
.process(css, { from: undefined })
.then(result => console.log(result.css));

Other packages similar to postcss-merge-rules

Keywords

FAQs

Package last updated on 03 Jan 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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc