diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass index f1607801..28fbfa4f 100755 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass @@ -30,16 +30,22 @@ // A container should group all your columns .container +container + .column, #{enumerate("div.span", 1, !blueprint_grid_columns)} + +column-base + // The last column in a row needs this class (or mixin) or it will end up on the next row. + .last, div.last + +last // Use these classes (or mixins) to set the width of a column. - @for !n from 1 to !blueprint_grid_columns + 1 + @for !n from 1 to !blueprint_grid_columns .span-#{!n} +span(!n) - div + .span-#{!blueprint_grid_columns}, div.span-#{!blueprint_grid_columns} + +span(!blueprint_grid_columns) + :margin 0 + input, textarea, select + @for !n from 1 through !blueprint_grid_columns &.span-#{!n} - +column(!n, !n == !blueprint_grid_columns) - // The last column in a row needs this class (or mixin) or it will end up on the next row. - div.last - +last + +span(!n, true) // Add these to a column to append empty cols. @for !n from 1 to !blueprint_grid_columns .append-#{!n} @@ -50,10 +56,10 @@ +prepend(!n) // Use these classes on an element to push it into the // next column, or to pull it into the previous column. - @for !n from 1 to !blueprint_grid_columns + 1 + @for !n from 1 through !blueprint_grid_columns .pull-#{!n} +pull(!n) - @for !n from 1 to !blueprint_grid_columns + 1 + @for !n from 1 through !blueprint_grid_columns .push-#{!n} +push(!n) @@ -69,16 +75,17 @@ // The last column in a row needs this mixin or it will end up on the next row. // TODO add this to span mixin when we have optional arguments =last - :margin - :right 0 + :margin-right 0 -=span(!n) - :width = !blueprint_grid_width * !n + (!blueprint_grid_margin * (!n - 1)) +=span(!n, !override = false) + !width = !blueprint_grid_width * !n + (!blueprint_grid_margin * (!n - 1)) + @if !override + :width = !width !important + @else + :width = !width -// Use this mixins to set the width of n columns. -=column(!n, !last = false) +=column-base(!last = false) +float-left - +span(!n) @if !last +last @else @@ -86,6 +93,12 @@ * html & :overflow-x hidden +// Use this mixins to set the width of n columns. +=column(!n, !last = false) + +column-base(!last) + +span(!n) + + // Mixin to a column to append n empty cols. =append(!n) :padding-right = (!blueprint_grid_outer_width) * !n diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass index 28fc5717..27301e28 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass @@ -9,37 +9,6 @@ !blueprint_grid_outer_width = !blueprint_grid_width + !blueprint_grid_margin !blueprint_container_size = !blueprint_grid_outer_width * !blueprint_grid_columns - !blueprint_grid_margin -=blueprint-grid - // A container should group all your columns - .container - +container - // Use these classes (or mixins) to set the width of a column. - @for !n from 1 to !blueprint_grid_columns + 1 - .span-#{!n} - +span(!n) - div - &.span-#{!n} - +column(!n, !n == !blueprint_grid_columns) - // The last column in a row needs this class (or mixin) or it will end up on the next row. - div.last - +last - // Add these to a column to append empty cols. - @for !n from 1 to !blueprint_grid_columns - .append-#{!n} - +append(!n) - // Add these to a column to prepend empty cols. - @for !n from 1 to !blueprint_grid_columns - .prepend-#{!n} - +prepend(!n) - // Use these classes on an element to push it into the - // next column, or to pull it into the previous column. - @for !n from 1 to !blueprint_grid_columns + 1 - .pull-#{!n} - +pull(!n) - @for !n from 1 to !blueprint_grid_columns + 1 - .push-#{!n} - +push(!n) - // Columns // Note: If you use this mixin without the class and want to support ie6 // you must set text-align left on your container element in an IE stylesheet. @@ -54,13 +23,8 @@ =last :margin-left 0 -=span(!n) - :width = !blueprint_grid_width * !n + (!blueprint_grid_margin * (!n - 1)) - -// Use this mixins to set the width of n columns. -=column(!n, !last = false) +=column-base(!last = false) +float-right - +span(!n) @if !last +last @else diff --git a/lib/sass_extensions.rb b/lib/sass_extensions.rb index dd3feafb..823817b3 100644 --- a/lib/sass_extensions.rb +++ b/lib/sass_extensions.rb @@ -12,6 +12,11 @@ module Sass::Script::Functions Sass::Script::String.new(nested) end + def enumerate(prefix, from, through) + selectors = (from.value..through.value).map{|i| "#{prefix.value}-#{i}"}.join(", ") + Sass::Script::String.new(selectors) + end + def image_url(path) http_images_path = if Compass.configuration.http_images_path == :relative if (target_css_file = options[:css_filename])