Skip to content

Instantly share code, notes, and snippets.

@darnocer
Last active August 13, 2022 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darnocer/ad6ed890ccc50d841d31e62f8a3a7883 to your computer and use it in GitHub Desktop.
Save darnocer/ad6ed890ccc50d841d31e62f8a3a7883 to your computer and use it in GitHub Desktop.
Variables, Mixins, Extends in SCSS

Variables, Mixins, and Extends in SCSS

Variables

// declare it
$text-color: red;`

// call it
font-color: $text-color;

Mixins

// declare it
@mixin typography {
  color: white;
  font-size: 1rem;
  text-transform: uppercase;
}

// call it
h1 {
  @include typography;
}

Extends

// declare it
%btn-placeholder {
  padding: 1rem;
  display: inline-block;
  text-align: center;
  border-radius: 100px;
}

// call it
.btn {
  @extend %btn-placeholder;
  background-color: blue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment