![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
postcss-discard-empty
Advanced tools
Package description
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.
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
cssnano is a modular minifier that includes functionalities to discard empty rules among other optimizations. It is more comprehensive than postcss-discard-empty as it performs a wide range of optimizations to reduce CSS size.
postcss-cleanup is another PostCSS plugin that can remove unused and duplicate code from CSS files, including empty rules. It provides a broader set of features for cleaning up CSS files compared to postcss-discard-empty.
purgecss is a tool to remove unused CSS, which can also result in the removal of empty rules if they become empty after purging unused styles. It differs from postcss-discard-empty by focusing on removing unused selectors rather than just empty ones.
Readme
Discard empty rules and values with PostCSS.
With npm do:
npm install postcss-discard-empty --save
For more examples see the tests.
@font-face;
h1 {}
{color:blue}
h2 {color:}
h3 {color:red}
h3 {color:red}
See the PostCSS documentation for examples for your environment.
See CONTRIBUTORS.md.
MIT © Ben Briggs
FAQs
Discard empty rules and values with PostCSS.
The npm package postcss-discard-empty receives a total of 8,525,219 weekly downloads. As such, postcss-discard-empty popularity was classified as popular.
We found that postcss-discard-empty 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
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.