Socket
Socket
Sign inDemoInstall

postcss-discard-empty

Package Overview
Dependencies
Maintainers
8
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-discard-empty

Discard empty rules and values with PostCSS.


Version published
Weekly downloads
11M
increased by4.88%
Maintainers
8
Weekly downloads
 
Created

What is postcss-discard-empty?

The postcss-discard-empty npm package is a PostCSS plugin that is used to remove empty rules, selectors, and at-rules from your CSS. This helps in reducing the size of the CSS file and cleaning up any unused or empty CSS declarations that may be left over after development or refactoring.

What are postcss-discard-empty's main functionalities?

Discard empty rules

This feature removes CSS rules that have no declarations inside them. For example, 'a{}' would be removed from the CSS because it's an empty rule.

postcss([ require('postcss-discard-empty') ]).process('a{}').css

Discard empty at-rules

This feature removes at-rules that have no content. For example, '@media screen {}' would be removed because it contains no rules or declarations.

postcss([ require('postcss-discard-empty') ]).process('@media screen {}').css

Discard empty selectors

This feature removes selectors that have no declarations. In the given code, 'b{}' would be removed, leaving only the selector 'a' with its declaration.

postcss([ require('postcss-discard-empty') ]).process('a{ color: red; } b{}').css

Other packages similar to postcss-discard-empty

Keywords

FAQs

Package last updated on 14 Dec 2023

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