Naming right can save time

Johan kleine Bjällskog
1 min readApr 24, 2023

You might end up in a project and get the task to change font-family , has that happened to you?

and when you start to look around you might see something like this :

export const fontNames = {
lato: '"Lato", "Helvetica", "Arial", sans-serif',
lucida: '"Lucida Grande", "Helvetica", "Arial", sans-serif',
}

and then you start thinking hmm… what was the point of making this variables?, you still need to go to all places and change the name on all places “lato” and “lucida” is used…

So instead it should have been like this :

export const fontNames = {
primayFont: '"NewFont", "Helvetica", "Arial", sans-serif',
secondaryFont: '"Newfont2", "Helvetica", "Arial", sans-serif',
}

then your assignment would have been much easier and smoother, because you can only change the font “lato” = “newFont” and so on and not on all the places they where used.

that's all for today, quick and good tip ;) I hope

--

--

Johan kleine Bjällskog

Lead front-end developer, movie lover and a junkie of series.