Skip to content

Instantly share code, notes, and snippets.

@gocs
Last active April 26, 2023 07:31
Show Gist options
  • Save gocs/b679eed47c50ae523a107cc9c5e4965e to your computer and use it in GitHub Desktop.
Save gocs/b679eed47c50ae523a107cc9c5e4965e to your computer and use it in GitHub Desktop.
loop over font styles and its font weights in faces

loop over font styles and its font weights in faces

make sure ./assets/static exists:

for angular, its should be located in ./src/assets/static

$faces: (
Thin: 100,
ExtraLight: 200,
Light: 300,
Regular: 400,
Medium: 500,
SemiBold: 600,
Bold: 700,
ExtraBold: 800,
Black: 900,
);
@each $style, $weight in $faces {
@font-face {
font-family: "Inter";
src: url('./assets/static/Inter-#{$style}.ttf') format('truetype');
font-style: to-lower-case(#{$style});
font-weight: $weight;
font-display: swap;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment