Skip to content

Instantly share code, notes, and snippets.

@chrisdavies
Created August 20, 2015 16:23
Show Gist options
  • Save chrisdavies/2712449b569a9d172b01 to your computer and use it in GitHub Desktop.
Save chrisdavies/2712449b569a9d172b01 to your computer and use it in GitHub Desktop.
File-scoped variables in SASS
// A single mixin per file allows file-scoped variables
@mixin theme-blue {
// File-scoped variables
$main-bg: white;
$main-fg: #333;
$accent-bg: #00B4EF;
$accent-fg: white;
$content-width: 700px;
$gutter-width: 1rem;
body {
background: $main-bg;
color: $main-fg;
}
.page-header,
.main-content {
max-width: $content-width;
margin: 0 auto;
}
.page-header {
padding-top: 2em $gutter-width;
background: $accent-color;
color: $accent-fg;
}
}
// Mixin the rules for this file
@include theme-blue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment