
Product
Announcing Precomputed Reachability Analysis in Socket
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
@csstools/postcss-content-alt-text
Advanced tools
Generate fallback values for content with alt text
npm install @csstools/postcss-content-alt-text --save-dev
PostCSS Content Alt Text generates fallback values for content
with alt text following the CSS Generated Content Module.
.foo {
content: url(tree.jpg) / "A beautiful tree in a dark forest";
}
.bar {
content: ">" / "";
}
/* becomes */
.foo {
content: url(tree.jpg) "A beautiful tree in a dark forest";
content: url(tree.jpg) / "A beautiful tree in a dark forest";
}
.bar {
content: ">" ;
content: ">" / "";
}
Add PostCSS Content Alt Text to your project:
npm install postcss @csstools/postcss-content-alt-text --save-dev
Use it as a PostCSS plugin:
const postcss = require('postcss');
const postcssContentAltText = require('@csstools/postcss-content-alt-text');
postcss([
postcssContentAltText(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
The preserve
option determines whether the original notation
is preserved. By default, it is preserved.
postcssContentAltText({ preserve: false })
.foo {
content: url(tree.jpg) / "A beautiful tree in a dark forest";
}
.bar {
content: ">" / "";
}
/* becomes */
.foo {
content: url(tree.jpg) "A beautiful tree in a dark forest";
}
.bar {
content: ">" ;
}
The stripAltText
option determines whether the alt text is removed from the value.
By default, it is not removed.
Instead it is added to the content
value itself to ensure content is accessible.
Only set this to true
if you are sure the alt text is not needed.
postcssContentAltText({ stripAltText: true })
.foo {
content: url(tree.jpg) / "A beautiful tree in a dark forest";
}
.bar {
content: ">" / "";
}
/* becomes */
.foo {
content: url(tree.jpg) ;
content: url(tree.jpg) / "A beautiful tree in a dark forest";
}
.bar {
content: ">" ;
content: ">" / "";
}
FAQs
Generate fallback values for content with alt text
The npm package @csstools/postcss-content-alt-text receives a total of 938,056 weekly downloads. As such, @csstools/postcss-content-alt-text popularity was classified as popular.
We found that @csstools/postcss-content-alt-text demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.