[GH-ISSUE #357] Library currently unsuitable for use in browsers, only native. #222

Closed
opened 2026-03-03 14:35:33 +03:00 by kerem · 4 comments
Owner

Originally created by @stevensacks on GitHub (Mar 27, 2017).
Original GitHub issue: https://github.com/lipis/flag-icons/issues/357

This library isn't suitable for a browser because you have every single flag in a separate file, which means if I want to show all the flags, I have to download 1 css file + 255 flag files. That's 256 http(s) requests. Not good.

The proper way to do this is a single sprite sheet with background positions. That's 2 files instead of 256. If you can write a build script to handle this, great. Otherwise, it's not suitable for use in browsers, only native apps.

Originally created by @stevensacks on GitHub (Mar 27, 2017). Original GitHub issue: https://github.com/lipis/flag-icons/issues/357 This library isn't suitable for a browser because you have every single flag in a separate file, which means if I want to show all the flags, I have to download 1 css file + 255 flag files. That's 256 http(s) requests. Not good. The proper way to do this is a single sprite sheet with background positions. That's 2 files instead of 256. If you can write a build script to handle this, great. Otherwise, it's not suitable for use in browsers, only native apps.
kerem closed this issue 2026-03-03 14:35:33 +03:00
Author
Owner

@seanfoo commented on GitHub (Mar 27, 2017):

@stevensacks,

if you want to create a sprite and upload it here. I'm sure the maintainer would consider including it in the build process. This might be helpful.

https://css-tricks.com/svg-sprites-use-better-icon-fonts/
https://github.com/jkphl/svg-sprite

We've been using the icons as given for over a year now with no issues, but we only include one flag per page. We can debate whether forcing every user to download a the 170kb serbian svg is appropriate or not. YMMV.

sean

<!-- gh-comment-id:289447959 --> @seanfoo commented on GitHub (Mar 27, 2017): @stevensacks, if you want to create a sprite and upload it here. I'm sure the maintainer would consider including it in the build process. This might be helpful. https://css-tricks.com/svg-sprites-use-better-icon-fonts/ https://github.com/jkphl/svg-sprite We've been using the icons as given for over a year now with no issues, but we only include one flag per page. We can debate whether forcing every user to download a the 170kb serbian svg is appropriate or not. YMMV. sean
Author
Owner

@lipis commented on GitHub (Mar 27, 2017):

Usually you would use a few of those flags and if actually you need all of them in one page.. I think anyone can use a sprite or something to cover their needs. This repo will have them separately.. sorry for that.

<!-- gh-comment-id:289456077 --> @lipis commented on GitHub (Mar 27, 2017): Usually you would use a few of those flags and if actually you need all of them in one page.. I think anyone can use a sprite or something to cover their needs. This repo will have them separately.. sorry for that.
Author
Owner

@stevensacks commented on GitHub (Mar 27, 2017):

For example, we have an international site and we have drop down where people choose what country they're from. We don't have EVERY country, but we have over 100. That's a lot of requests for each user to make to load the page. We like your flags, but we can't use them unless there's a sheet.

As far as Serbia goes, is that the raw size or gzipped?

<!-- gh-comment-id:289497714 --> @stevensacks commented on GitHub (Mar 27, 2017): For example, we have an international site and we have drop down where people choose what country they're from. We don't have EVERY country, but we have over 100. That's a lot of requests for each user to make to load the page. We like your flags, but we can't use them unless there's a sheet. As far as Serbia goes, is that the raw size or gzipped?
Author
Owner

@lipis commented on GitHub (Mar 27, 2017):

well I would recommend you to create a simple script that combines the ones that you want.. the total size would still include Serbia..

<!-- gh-comment-id:289502940 --> @lipis commented on GitHub (Mar 27, 2017): well I would recommend you to create a simple script that combines the ones that you want.. the total size would still include Serbia..
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/flag-icons#222
No description provided.