mixtur / webpack-spritesmith

Webpack plugin that converts set of images into a spritesheet and SASS/LESS/Stylus mixins
499 stars 56 forks source link

Sprites with the same name as other sprites are inaccessible and should not be included in generated spritesheet #80

Closed OlenDavis closed 5 years ago

OlenDavis commented 5 years ago

I found recently that sprites that have the same name as other sprites are included in the generated spritesheet. And yet, unless you customize your particular spritesheet template use sprites based on their source_files rather than your configured naming scheme (which is by default the extension-less name of the sprite's image), they'll be in the generated spritesheet image, but never really accessible.

While there is certainly the possibility of developers out there who are savvier than me and have accounted for this by making modifications to their spritesmith template of choice, I'd be shocked if even the fact of this behavior were even common knowledge for most developers. ('Cause quite frankly, very few developers probably have a legitimate use case for spritesheets that intentionally target sprites of the same name, actually desiring the effect of overriding other sprites, making them inaccessible.)

In sum, I think actually excluding these inaccessible sprites would simply result in a filesize savings for developers who are both (1) in the unfortunate position of having sprites that are overriding other sprites, certainly if (2) they're unaware that that's the case. So I've made a fork of the plugin implementing this how I would do it (and using it in my project), and I'd love to know if there's anything you'd like me to do to it to make it mergeable.

https://github.com/mixtur/webpack-spritesmith/pull/79

mixtur commented 5 years ago

fixed in webpack-spritesmith@1.0.0