From d67a43ad4bc70d4764c1f3eb8f4afdeeb07be007 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 2 Jan 2011 10:43:59 -0800 Subject: [PATCH] Make a span() function for blueprint that returns the width in pixels of $n columns. --- .../blueprint/stylesheets/blueprint/_grid.scss | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frameworks/blueprint/stylesheets/blueprint/_grid.scss b/frameworks/blueprint/stylesheets/blueprint/_grid.scss index 30a38e06..6b6aa28d 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_grid.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_grid.scss @@ -108,16 +108,20 @@ $blueprint-container-size: $blueprint-grid-outer-width * $blueprint-grid-columns @include column-base($last); @include span($n); } +// Return the width of `$n` columns. +@function span($n) { + @return $blueprint-grid-width * $n + $blueprint-grid-margin * ($n - 1); +} + // Set only the width of an element to align it with the grid. // Most of the time you'll want to use `+column` instead. // // This mixin is especially useful for aligning tables to the grid. -@mixin span($n, $override: false) { - $width: $blueprint-grid-width * $n + $blueprint-grid-margin * ($n - 1); - @if $override { - width: $width !important; } +@mixin span($n, $important: false) { + @if $important { + width: span($n) !important; } @else { - width: $width; } } + width: span($n); } } // The basic set of styles needed to make an element // behave like a column: