
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
postcss-uncss-jsdom
Advanced tools
Use giakki/uncss jsdom branch as a PostCSS plugin.
UnCSS is a tool that removes unused CSS from your stylesheets. It works across multiple files and supports Javascript-injected CSS.
html:
<body>
<p class="red">Hello World!</p>
</body>
css before:
.red {
color: red;
}
.blue {
color: blue;
}
css after:
.red {
color: red;
}
The HTML files are loaded by jsdom and JavaScript is executed. UnCSS filters out selectors that are not found in the HTML files.
See the UnCSS docs for more information.
postcss-uncss-jsdom specifies UnCSS-jsdom as a peerDependency, so you will have to install UnCSS-jsdom as well.
npm install postcss-uncss-jsdom uncss-jsdom
postcss-uncss-jsdom's MAJOR & MINOR version numbers correspond to UnCSS-jsdom's version numbers; however, the PATCH version number may differ.
postcss([ require('postcss-uncss') ])
See PostCSS docs for examples for your environment.
html (Array): provide a list of html files to parse for selectors and elements. Usage of globs is allowed.
ignore (Array): provide a list of selectors that should not be removed by UnCSS. For example, styles added by user interaction with the page (hover, click), since those are not detectable by UnCSS yet. Both literal names and regex patterns are recognized. Otherwise, you can add a comment before specific selectors in your css:
/* uncss:ignore */
.selector1 {
/* this rule will be ignored */
}
.selector2 {
/* this will NOT be ignored */
}
{
html: ['index.html', 'about.html', 'team/*.html'],
ignore: ['.fade']
}
FAQs
Use giakki/uncss jsdom branch as a postcss plugin
We found that postcss-uncss-jsdom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.