Decorative images in f-vue-icons
#742
Replies: 2 comments 3 replies
-
Re 2.b), I guess what we should do is to basically upload whatever is on Regarding the following:
Maybe a stupid question, but is there any reason not to do this with every single image, rather than just non-critical SVGs? |
Beta Was this translation helpful? Give feedback.
-
Just a few things I tried in my spare time that's worth looking into. I also asked around in the webpack and Vue community as the below wouldn't quite work for me (in the consuming app side, step 4) We could set babel to allow
Main advantage of the above means there's not much extra effort config wise. |
Beta Was this translation helpful? Give feedback.
-
We've had a few discussions around how we could potentially include decorative images so that they can be served via cdn rather than inlining them in the bundle of a component.
During a conversation on a separate PR, I remembered that all of our icons in
f-icons
automatically get published tounpkg
(which pushes all dist assets up to cloudflare) – so I was thinking a similar solution should be:1. Decorative SVG's could be added to
f-vue-icons
2. Either
a) we use unpkg (probably not recommended as we probably shouldn't rely on a hobby project for serving our images) or
b) we link our own CDN to grab latest distribution files from the
f-icons
package (guessing this should be possible as that's effectively whatunpkg
does)3. We then modify
f-vue-icons
to accept a bit of config when asking for an icon so that instead of outputting an inline SVG icon as the result, it instead outputs an image such as:The above would mean non critical SVGs are then served via CDN, and not bundled inline inside our components, making the bundle size smaller.
Thoughts? If anyone has any idea how easy part 2. b) would be, that would be awesome, as that's the only part I'm unsure about really. Not sure if it would just be some CDN config somewhere that we could point at NPM (or something we could add into the build of
f-icons
to push the dist folder up to CDN?)Beta Was this translation helpful? Give feedback.
All reactions