Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about webpack #35

Closed
mesqueeb opened this issue Jul 30, 2019 · 1 comment
Closed

Question about webpack #35

mesqueeb opened this issue Jul 30, 2019 · 1 comment
Labels
question Further information is requested

Comments

@mesqueeb
Copy link

mesqueeb commented Jul 30, 2019

I'm a VueJS developer, and most of us use webpack to bundle their apps. (usually via default config of a CLI framework like vue-cli etc.)

When it comes to inlining svg's, the go-to library is usually:
https://github.com/oliverfindl/vue-svg-inline-loader

This is a simple "webpack extension" that swaps out <img> for the actual <svg> upon build.

I wonder what the difference is between this library and a webpack loader like I mentioned above.
If there are benefits for this library over a webpack loader, I might consider swapping out the webpack loader for this library!

This might be an interesting Q&A to add to the Readme! ;)

@dasboe
Copy link
Collaborator

dasboe commented Jul 30, 2019

Pro Dynamic SVG Loading (SVGInject)

(1) Universality
Same usage in every framework / no framework

(2) Smaller bundle size
The SVGs are not part of the bundle and load on demand

(3) Prevention of Id conflicts
IDs in the SVG are made unique before injection to prevent ID conflicts in the DOM. It's not possible by design to do this within a bundle build (see #19)

Pro Webpack Extension

(1) SVG Display Time when first shown
The SVGs do not need to load when displayed first

(2) Fewer network connections
Before cached each SVG needs to load separately when displayed in the Dynamic SVG Loading approach

This might be not complete...

In my opinion the README would get a bit bloated but the result of this Issue might go into the Wiki

@dasboe dasboe added the question Further information is requested label Jul 30, 2019
@dasboe dasboe closed this as completed Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants