Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
svg-spritemap-webpack-plugin
Advanced tools
Generates symbol-based SVG spritemap from all .svg files in a directory
This webpack plugin generates a single SVG spritemap containing multiple <symbol>
elements from all .svg
files in a directory. In addition, it can optimize the output and can also generate a stylesheet containing the sprites to be used directly from CSS. Chris Coyier has a good write-up about the why's and how's of this technique on CSS Tricks. Use it in combination with the svg4everybody
package to easily and correctly load SVGs from the spritemap in all browsers.
npm install svg-spritemap-webpack-plugin --save-dev
Webpack configuration
This plugin can be added to webpack like any other, documentation on all configuration options is available.
const SVGSpritemapPlugin = require('svg-spritemap-webpack-plugin');
module.exports = {
// ...
plugins: [
new SVGSpritemapPlugin()
]
}
SVG element
When there's a file phone.svg
in the source directory and the prefix
option is set to sprite-
(default), the sprite can be included in a HTML-file like so:
<svg>
<use xlink:href="/path/to/spritemap.svg#sprite-phone"></use>
</svg>
SVG for Everybody adds SVG External Content support to all browsers.
It's a good idea to combine the svg-spritemap-webpack-plugin
with svg4everybody
. This can be done by passing an options object or true
to the svg4everybody
options key or by executing SVG4Everybody manually.
FAQs
Generates symbol-based SVG spritemap from all .svg files in a directory
The npm package svg-spritemap-webpack-plugin receives a total of 22,647 weekly downloads. As such, svg-spritemap-webpack-plugin popularity was classified as popular.
We found that svg-spritemap-webpack-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.