
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
postcss-preload-hovers
Advanced tools
A plugin to search for images with the :hover pseudo-class and generate links to preload them
PostCSS plugin
In our application we have found that it is necessary to preload images in CSS elements with the :hover pseudo-class, as the loading delay is very obvious the
first time a user rolls over one of these elements.
npm install --save-dev postcss postcss-preload-hovers
.my-button:hover {
background-image: url(rollover.svg);
}
With outputType: "html" (or omitted as this is the default):
<link rel="prefetch" href="rollover.svg" as="image">
With outputType: "js":
["rollover.svg"].forEach(function(url) { var link = document.createElement("link"); link.rel = "prefetch"; link.href = url; link.as = "image"; document.head.appendChild(link); });
This requires writing a custom stringifier (just copy the code below).
postcss([ require('postcss-preload-hovers')() ]).process(input, { stringifier: (root, builder) => root.walkComments(comment => builder(comment.text + "\n")) });
To write to a file provide a filename property.
postcss([ require('postcss-preload-hovers')({ outputType: "js", filename: "output.js" }) ]).process(input)
This is ugly, but useful.
const resultObj = {};
postcss([ require('postcss-preload-hovers')({ resultObj }) ]).process(input).then(_ => { /* The result will be available as a string at resultObj.data */ });
See PostCSS docs for examples for your environment.
FAQs
A plugin to search for images with the :hover pseudo-class and generate links to preload them
We found that postcss-preload-hovers 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.