Skip to content

Instantly share code, notes, and snippets.

@abdallahmalima
Last active November 12, 2022 02:09
Show Gist options
  • Save abdallahmalima/bc95769d9b4d27ab8b295a582b073357 to your computer and use it in GitHub Desktop.
Save abdallahmalima/bc95769d9b4d27ab8b295a582b073357 to your computer and use it in GitHub Desktop.
Check DRY principle
/*=======================================*\
this code does Not follow DRY principle
\*=======================================*/
.cat {
font-family: "Times New Roman", Times, serif;
font-size: 1rem;
color: #FFF;
}
.dog {
font-family: "Times New Roman", Times, serif;
font-size: 1rem;
color: #000;
}
.dragon {
font-family: "Times New Roman", Times, serif;
font-size: 1rem;
color: #009933;
}
/*=======================================*\
this code does follow DRY principle
\*=======================================*/
:root {
--primary-font-family: "Times New Roman", Times, serif;
--primary-font-size:1rem;
}
.cat {
font-family: var(--primary-font-family);
font-size: var(--primary-font-size);
color: #FFF;
}
.dog {
font-family: var(--primary-font-family);
font-size: var(--primary-font-size);
color: #000;
}
.dragon {
font-family: var(--primary-font-family);
font-size: var(--primary-font-size);
color: #009933;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment