🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

svg-sprite-generation-loader

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-sprite-generation-loader - npm Package Compare versions

Comparing version

to
2.1.0

{
"name": "svg-sprite-generation-loader",
"version": "2.0.18",
"version": "2.1.0",
"description": "Webpack loader for generating external svg symbol sprite files",

@@ -5,0 +5,0 @@ "main": "index.js",

const svgSpriteState = require('./utils/spriteState');
class SvgSpriteGeneratorPlugin {
constructor(params) {
this.params = params;
}
// eslint-disable-next-line class-methods-use-this

@@ -25,3 +29,3 @@ apply(compiler) {

spriteFilePath,
new RawSource(svgSpriteState.getSpriteContent(spriteFilePath))
new RawSource(svgSpriteState.getSpriteContent(spriteFilePath, this.params))
);

@@ -28,0 +32,0 @@ });

@@ -11,6 +11,6 @@ class SvgSpriteGenerationState {

getSpriteContent(spriteFilePath) {
getSpriteContent(spriteFilePath, options = {}) {
return `${Object.keys(this.sprites[spriteFilePath]).reduce(
(result, iconId) =>
`${result}<symbol viewBox="${this.sprites[spriteFilePath][iconId].attributes.viewBox}" fill="none" id="${iconId}">${this.sprites[spriteFilePath][iconId].content}</symbol>`,
`${result}<symbol viewBox="${this.sprites[spriteFilePath][iconId].attributes.viewBox}"${options.unsetSymbolFill ? '' : ' fill="none"'} id="${iconId}">${this.sprites[spriteFilePath][iconId].content}</symbol>`,
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">'

@@ -17,0 +17,0 @@ )}</svg>`;