Repository navigation
Add CSS sprite to @tabler/flags - #16
Merged
Merged
Conversation
Pack every source flag into dist/sprite/flags.svg and emit flags.css with a .flag-<slug> / .flag-<iso> class per flag, plus flags.json with cell offsets. Aliases reuse the cell of the flag they point to.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Open
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@tabler/flags:dist/sprite/flags.svgpacks all 297 flags into one 20x15 grid, anddist/sprite/flags.cssshows one flag per element withbackground-position..flag-<slug>and.flag-<iso>classes. Aliases such asflag-sjreuse the cell of the flag they point to..flag-roundedadds the corners and border of theroundedvariant with plain CSS instead of a second sprite.dist/sprite/flags.jsonlists the pixel offset of every cell for custom CSS. Documented in both READMEs, with a minor changeset.Preview
pnpm build:flags, then open a page with<link rel="stylesheet" href="packages/flags/dist/sprite/flags.css">and<span class="flag flag-rounded flag-pl"></span>. Changefont-sizeon the span and check the flag scales. Compareflag-sjwithflag-no.Notes / rollout
@tabler/flags, so the package tarball grows by that much.flags.svgandflags.csstogether.