
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Remove undefined CSS class attributes from your HTML.
This Gem will, given a set of HTML files and a set of CSS files, remove any mentions in the class attributes of HTML objects classes that are not defined in the CSS files.
Given the following files
index.html
<html>
<body>
<h1 class="happy sad">Heading</h1>
<p class="red blue">Hello</p>
</body>
</html>
app.css
.red {
color: red;
}
.happy {
color: black;
}
Running CSSDeadClass on those two files will change index.html
to the following, remove calls to .sad
and .blue
, as they do not exist:
<html>
<body>
<h1 class="happy">Heading</h1>
<p class="red">Hello</p>
</body>
</html>
Install using gem css_dead_class
.
CSSDeadClass takes three options:
:css_files
An array of file paths to CSS files to scan.
:html_files
An array of file paths to HTML files to scan.
:classes_to_keep
An array of CSS classes to keep, regardless of presence in the HTML files. Can either be of the form .classname
or classname
.
Sample usage in a ruby program:
require 'css_dead_classes'
css_deadfiles = CSSDeadClass.new({
html_files: Dir.glob("**/*.html"),
css_files: Dir.glob("**/*.css"),
classes_to_keep: [
".no-js",
"blue"
]
})
css_deadfiles.parse
FAQs
Unknown package
We found that css_dead_class 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
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.