Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fabricelejeune's full-sized avatar

Fabrice Lejeune fabricelejeune

View GitHub Profile

Keybase proof

I hereby claim:

  • I am fabricelejeune on github.
  • I am fabricelejeune (https://keybase.io/fabricelejeune) on keybase.
  • I have a public key whose fingerprint is D7EA 32A8 01D6 9291 0793 0DAE 6558 40B7 561D 8B5D

To claim this, I am signing this object:

@fabricelejeune
fabricelejeune / Efficient font stack with Sass.md
Last active March 16, 2023 23:52
Efficient font stack with Sass

Efficient font stack with Sass

The strength of Sass is the mixins and functions. Being able to automate many of the repetitive coding for CSS is both amazing in building and maintaining a clean and efficient code. I often find many developers creating complex systems for simple tasks, such as managing a font stack. This can be tedious to set up and employ. In this article, I will explain how I automate this system.

The font stack is one of those problems which are often solved by simple variables. In this instance, it makes a lot of sense and is easy enough to work with. But when you work with our (beloved) designers from Dogstudio, you can be sure of having to use lot of font variants. It quickly happens that I do not remember all the properties of each variants. And when I say "use lot of font variants", I mean at least 15 in most cases.

Sass maps to the rescue

Instead of simply define variables, I will ceate a font stack map and a mixin to use the map easily.