Skip to content

Overriding Constants

mrajcok edited this page Sep 13, 2010 · 6 revisions

Sass provides a way of setting a variable using conditional assignment. This is useful for initializing constants with a value unless they are already set. Compass uses conditional assignment for all configurable constants.

To override a compass default value for any constant, create a Sass partial file named _base.sass and define values for configurable constants in that file. Ensure these definitions appear before importing any compass libraries that use the constants.

Example 1

_base.sass

!blueprint_grid_columns = 32

screen.sass

@import base.sass, blueprint/modules/grid.sass

#header
  +column(32)

Example 2

_base.sass

!blueprint_grid_columns = 32

@import blueprint/modules/grid.sass

screen.sass

@import base.sass

#header
  +column(32)
Clone this wiki locally