ubaldop / vue-country-flag

Vue component for country flags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flag sprite is Base64 Encoded causing a 30% increase in size

MatthewAry opened this issue · comments

Just thought you should know that Base64 encoding images should be avoided. See: https://stackoverflow.com/a/11402374/2719773

The production JS files seem to have the flag sprite embedded as a Base64 string. I think that this is not necessary. Modern server and HTTP protocols help minimize the impact of making multiple requests for resources. I think that it will have a better impact on overall build sizes with minimal performance impact by requesting the image as a file instead of parsing the string.

Hi Matthew, thank you for pointing that. Indeed, in previous versions of the component the image was not Base64 encoded. Later, I encoded it because of an issue (see #11).
If your proposal is a way to reduce component size, please help me in doing that ☺️
Otherwise I'll try to improve it as soon as I can find some free time.

Despite a bigger size of the final package, at the moment I stay with a Base64 encoded sprite in the css. The main reason is to make this component independent from any bundling process.

Here it is an interesting discussion about that.

I leave this as an enhancement proposal though.

Duplicate, see #30.