Skip to content

Instantly share code, notes, and snippets.

@silouanwright
Created March 7, 2024 17:05
Show Gist options
  • Save silouanwright/13c4549288cfd52007866574ccde8e47 to your computer and use it in GitHub Desktop.
Save silouanwright/13c4549288cfd52007866574ccde8e47 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// Define SCSS variables with default values
$header-color: purple;
$font-size: 16px;
// Create CSS custom properties with the same names and default values
:root {
--header-color: #{$header-color};
--font-size: #{$font-size};
}
// Global class selector
.brand-2024 {
// Redefine CSS custom properties with desired values
--header-color: red;
--font-size: 18px;
}
// Use CSS custom properties in your styles
h1 {
color: var(--header-color);
font-size: var(--font-size);
}
<div class="brand-2024">
<h1>Hello Joe!</h1>
</div
>
:root {
--header-color: purple;
--font-size: 16px;
}
.brand-2024 {
--header-color: red;
--font-size: 18px;
}
h1 {
color: var(--header-color);
font-size: var(--font-size);
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment