ember-svg-jar icon indicating copy to clipboard operation
ember-svg-jar copied to clipboard

364K (uncompressed) of mostly unused icons?

Open sdhull opened this issue 4 years ago • 5 comments

Is the "inline" strategy really supposed to include every single icon in vendor.js?

Describe your question

I was under the impression that at build-time, {{svg-jar "plus-icon"}} would be replaced by <svg..>...</svg>. Is this not the case? Should I not be adding icons to my project until they're being used?

image image

Search tags, topics

package size, compiled size

sdhull avatar Mar 21 '20 07:03 sdhull

It will include all .svg files that it can find in sourceDirs (public dir by default ). So I would suggest to add only the icons you need.

I have a plan to make it possible to tell SVGJar what icons you need, so you can add all your icon sets to the SVGJar viewer without adding them to the vendor.js file.

voltidev avatar Mar 21 '20 11:03 voltidev

Yeah that would be really cool. Like a config option onlyInclude: ['add.svg', /somepath\/.*svg/] and if that is empty or undefined then it includes everything by default? Or would you scan for usages of {{svg-jar and only include icons referenced automagically?

After looking through the options again, it looks like I could at least keep all my icons in my repo and then specify sourceDir and only copy or move icons over as needed so not toooo bad but I wish I could have them all in the viewer but only include icons in the build that are referenced (or failing that, whitelist them as needed for inclusion in the build).

sdhull avatar Mar 21 '20 22:03 sdhull

It will include all .svg files that it can find in sourceDirs (public dir by default ). So I would suggest to add only the icons you need.

I have a plan to make it possible to tell SVGJar what icons you need, so you can add all your icon sets to the SVGJar viewer without adding them to the vendor.js file.

Has there been any progress with this?

wilkosz avatar Oct 13 '20 23:10 wilkosz

Just hit this today.

I think every svg files is included in the final build really is an unexpected behavior nowadays, probably should say something about it in the readme

xud6 avatar Dec 02 '20 09:12 xud6

I think this could be solved with the new hbs strategy #186 , they are converted to template-only components at build time and downloaded when invoked in runtime, so there's 0 kbs added to vendor, they pretty much kinda work like a normal image tag... with the benefits of splattributes and modifiers!

betocantu93 avatar Mar 24 '21 01:03 betocantu93