cascornelissen / svg-spritemap-webpack-plugin

SVG spritemap plugin for webpack
MIT License
207 stars 51 forks source link

Do not allow boolean value as postfix for fragment option #93

Closed toooni closed 4 years ago

toooni commented 4 years ago

Whether to include a element for each sprite within the generated spritemap to allow referencing via fragment identifiers. Passing a string will use the value as a postfix for the id attribute.

At the moment passing of a boolean value does also add a postfix true or false. This results in identifiers like this: .arrow-left { background-image: url("/build/sprite.svg#arrow-leftfalse"); }

cascornelissen commented 4 years ago

First of all, thanks for the notice and the PR!

LGTM, one minor remark to make this logic a little more readable:

const postfix = typeof options.postfix.view === 'boolean' ? '' : options.postfix.view;
return `${options.format.publicPath}#${options.prefix}${selector}${postfix}`

If you could change that for the three files I'll merge it and release a new patch version.


Edit: I'll make the changes myself. Thanks for your contribution!

cascornelissen commented 4 years ago

@toooni, this fix has been released in version 3.5.1 🚀