Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Last active December 16, 2020 11:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjaap/6b6fe7f0b4fce183f5ef881956ccca61 to your computer and use it in GitHub Desktop.
Save peterjaap/6b6fe7f0b4fce183f5ef881956ccca61 to your computer and use it in GitHub Desktop.
Tailwind font-weights check

Tailwind font-weights check

Check which font weights are used. I used this to determine which Google Fonts I want to include.

Before;

https://fonts.googleapis.com/css2?family=Lato:wght@100;200;300;400;500;600;700;800;900&display=swap

Then I run this little script;

#!/bin/bash
for n in thin extralight light normal medium semibold bold extrabold black
do
    echo "$n: " | tr -d '\n' && find . -type f -iname "*.phtml" | xargs grep font-$n | wc -l
done

This gives me;

thin: 0
extralight: 0
light: 0
normal: 11
medium: 17
semibold: 6
bold: 5
extrabold: 0
black: 0

So I see I can leave out thin (100), extralight (200), light (300), extrabold (800) & black (900);

https://fonts.googleapis.com/css2?family=Lato:wght@400;500;600;700&display=swap
@peterjaap
Copy link
Author

Caveat; if you use these font-weight classes using @apply in a custom CSS sheet, double-check those too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment