Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
postcss-discard-unused
Advanced tools
Discard unused counter styles, keyframes and fonts.
With npm do:
npm install postcss-discard-unused --save
This module will discard unused at rules in your CSS file, if it cannot find
any selectors that make use of them. It works on @counter-style
, @keyframes
and @font-face
.
@counter-style custom {
system: extends decimal;
suffix: "> "
}
@counter-style custom2 {
system: extends decimal;
suffix: "| "
}
a {
list-style: custom
}
@counter-style custom {
system: extends decimal;
suffix: "> "
}
a {
list-style: custom
}
Note that this plugin is not responsible for normalising font families, as it makes the assumption that you will write your font names consistently, such that it considers these two declarations differently:
h1 {
font-family: "Helvetica Neue"
}
h2 {
font-family: Helvetica Neue
}
However, you can mitigate this by including postcss-minify-font-values before this plugin, which will take care of normalising quotes, and deduplicating. For more examples, see the tests.
See the PostCSS documentation for examples for your environment.
Type: boolean
Default: true
Pass false
to disable discarding unused font face rules.
Type: boolean
Default: true
Pass false
to disable discarding unused counter style rules.
Type: boolean
Default: true
Pass false
to disable discarding unused keyframe rules.
Type: boolean
Default: true
Pass false
to disable discarding unused namespace rules.
Thanks goes to these wonderful people (emoji key):
Ben Briggs 💻 📖 👀 ⚠️ | Bogdan Chadkin 💻 📖 👀 ⚠️ | Paweł Lesiecki 💻 ⚠️ |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT © Ben Briggs
FAQs
Discard unused counter styles, keyframes and fonts.
The npm package postcss-discard-unused receives a total of 656,650 weekly downloads. As such, postcss-discard-unused popularity was classified as popular.
We found that postcss-discard-unused 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.