coma / gulp-svg-icons

Inserting SVG icons was never so easy.
MIT License
24 stars 3 forks source link

multiple injections on placeholder src #2

Closed Spica2 closed 10 years ago

Spica2 commented 10 years ago
.src('build/*.html')
.pipe(icons.inject())

when I run this on three files each with one same svg icon, each html gets the icon symbol code injected three times with the same id. One should be enough.

coma commented 10 years ago

Maybe it should be optional, something like "inject only the icons used in that file". In my case I have all the icons in one place (index.html) and load all the views using AngularJS, that's why I need to inject icons that are not being used in the file.

Another solution available right now, is to inject them only into one SVG file and use the new "external" option.

Let me know your opinion to add the functionality.

Spica2 commented 10 years ago

I havent tested the external option yet. But I assume I will run into the same problem: same icon gets multiple injected, depending on how often the placeholder will be found over all piped html files. e.g. icon-star is used in three html files but gets injected in all three html files tree times. Is that a gulp-svg-icons issiu or do I have to construct the pipe differently?

coma commented 10 years ago

Ah! that seems to be a bug... I'll check it out.

coma commented 10 years ago

Fixed!

@Spica2, please run npm update to get the new 0.5.4 version.

Spica2 commented 10 years ago

great

coma commented 10 years ago

Thank you @Spica2, keep me informed of any issue!