Compass/compass

View on GitHub
compass-style.org/content/help/tutorials/configurable-variables.haml

Summary

Maintainability
Test Coverage
---
title: Working with Configurable Variables
layout: tutorial
classnames:
  - tutorial
---

:markdown
  Working with Configurable Variables
  ===================================

  There are two ways of defining a variable in Sass. The first, most common, approach is
  simple assignment. For example:

      $my-constant : #fedcba

  The second approach is called guarded assignment. In this case, the constant is only
  set if it does not already have a value. For example:

      $my-constant : #fedcba !default

  Many compass modules use guarded assignment to allow you to set defaults for that module.
  In order for these configurable variables to work correctly, you must set the variables
  *before* you import the module. For example:

      $blueprint-grid-columns = 12
      @import "blueprint/grid"

  Because of this, it is common to have one or more partials
  that set the constants first and get imported before any other
  imports in your stylesheet(s). This is commonly referred to as
  the "base" stylesheet and is usually named `_base.scss` or `_base.sass`.