Documentation on guarded variables.
This commit is contained in:
parent
41f1f30e0f
commit
bc22684dc8
@ -90,6 +90,8 @@ body.reference
|
|||||||
width: 100px
|
width: 100px
|
||||||
height: 20px
|
height: 20px
|
||||||
+border-radius(3px)
|
+border-radius(3px)
|
||||||
|
a.help
|
||||||
|
font-size: 75%
|
||||||
|
|
||||||
|
|
||||||
.tipsy
|
.tipsy
|
||||||
|
30
doc-src/content/tutorials/configurable-variables.haml
Normal file
30
doc-src/content/tutorials/configurable-variables.haml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
title: Working with Configurable Variables
|
||||||
|
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
|
||||||
|
|
||||||
|
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.sass`.
|
@ -11,6 +11,9 @@
|
|||||||
%li
|
%li
|
||||||
%a{:href => "/docs/best_practices/"}
|
%a{:href => "/docs/best_practices/"}
|
||||||
Best practices
|
Best practices
|
||||||
|
%ul
|
||||||
|
%li
|
||||||
|
%a{:href => "/docs/tutorials/configurable-variables/"} Configurable Variables
|
||||||
%li
|
%li
|
||||||
%a{:href => "/docs/frameworks/"}
|
%a{:href => "/docs/frameworks/"}
|
||||||
Working with plugins and frameworks
|
Working with plugins and frameworks
|
||||||
|
Loading…
Reference in New Issue
Block a user