Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
postcss-discard-empty
Advanced tools
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.
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.
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.
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs
FAQs
Discard empty rules and values with PostCSS.
The npm package postcss-discard-empty receives a total of 3,982,270 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.