evoactivity / ember-svg-jar

🍯 Best way to use SVG images in Ember apps
https://svgjar.web.app
251 stars 73 forks source link

364K (uncompressed) of mostly unused icons? #154

Open sdhull opened 4 years ago

sdhull commented 4 years ago

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

voltidev commented 4 years ago

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.

sdhull commented 4 years ago

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).

wilkosz commented 4 years ago

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?

xud6 commented 3 years ago

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

betocantu93 commented 3 years ago

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!