Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
rehype-remove-unused-css
Advanced tools
Rehype plugin to remove unused stylesheet with uncss
npm install rehype-remove-unused-css
Say example.html
looks as follows;
<html>
<head>
<style>
.one {
font-size: 1em;
}
.two {
font-size: 2em;
}
</style>
</head>
<body>
<p class="one">example</p>
</body>
</html>
...and example.js
like this:
const vfile = require("to-vfile")
const report = require("vfile-report")
const unified = require("unified")
const rehype = require("rehype-parse")
const stringify = require("rehype-stringify")
const removeUnusedCss = require("rehype-remove-unused-css")
unified()
.use(rehype)
.use(removeUnusedCss)
.use(stringify)
.processSync(vfile.readSync("example.html"), (err, file) => {
console.error(report(err || file))
console.log(String(file))
})
Now, running node example
yields:
<html>
<head>
<style>
.one {
font-size: 1em;
}
</style>
</head>
<body>
<p class="one">example</p>
</body>
</html>
rehype().use(removeUnusedCss[, options])
Remove unused stylesheet.
options
is same as options of uncssUse of rehype-remove-unused-css should be safe to use as JSDOM should be safe to use. When in doubt, use rehype-sanitize.
MIT © TANIGUCHI Masaya
FAQs
Rehype plugin to remove unused stylesheet with uncss
The npm package rehype-remove-unused-css receives a total of 1 weekly downloads. As such, rehype-remove-unused-css popularity was classified as not popular.
We found that rehype-remove-unused-css 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.