mirror of
https://github.com/lipis/flag-icons.git
synced 2026-04-26 09:25:50 +03:00
[GH-ISSUE #357] Library currently unsuitable for use in browsers, only native. #222
Labels
No labels
3rd-party
3rd-party
bug
code
documentation
enhancement
fixed-in-master
flag-request
help needed
missing-flag
missing-flag
pull-request
wrong-flag
wrong-flag
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/flag-icons#222
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
@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
@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.
@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?
@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..