Incorporate Blueprint 0.8 grid changes, make the generated grid more closely match Blueprint's by adding an enumerate(prefix, startindex, endindex) sass function that generates a list of enumerated selectors.
This commit is contained in:
parent
759c422c34
commit
c36f63fd92
@ -30,16 +30,22 @@
|
|||||||
// A container should group all your columns
|
// A container should group all your columns
|
||||||
.container
|
.container
|
||||||
+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.
|
// 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}
|
||||||
+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}
|
&.span-#{!n}
|
||||||
+column(!n, !n == !blueprint_grid_columns)
|
+span(!n, true)
|
||||||
// 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.
|
// Add these to a column to append empty cols.
|
||||||
@for !n from 1 to !blueprint_grid_columns
|
@for !n from 1 to !blueprint_grid_columns
|
||||||
.append-#{!n}
|
.append-#{!n}
|
||||||
@ -50,10 +56,10 @@
|
|||||||
+prepend(!n)
|
+prepend(!n)
|
||||||
// Use these classes on an element to push it into the
|
// Use these classes on an element to push it into the
|
||||||
// next column, or to pull it into the previous column.
|
// 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}
|
||||||
+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}
|
||||||
+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.
|
// 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
|
// TODO add this to span mixin when we have optional arguments
|
||||||
=last
|
=last
|
||||||
:margin
|
:margin-right 0
|
||||||
:right 0
|
|
||||||
|
|
||||||
=span(!n)
|
=span(!n, !override = false)
|
||||||
:width = !blueprint_grid_width * !n + (!blueprint_grid_margin * (!n - 1))
|
!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-base(!last = false)
|
||||||
=column(!n, !last = false)
|
|
||||||
+float-left
|
+float-left
|
||||||
+span(!n)
|
|
||||||
@if !last
|
@if !last
|
||||||
+last
|
+last
|
||||||
@else
|
@else
|
||||||
@ -86,6 +93,12 @@
|
|||||||
* html &
|
* html &
|
||||||
:overflow-x hidden
|
: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.
|
// Mixin to a column to append n empty cols.
|
||||||
=append(!n)
|
=append(!n)
|
||||||
:padding-right = (!blueprint_grid_outer_width) * !n
|
:padding-right = (!blueprint_grid_outer_width) * !n
|
||||||
|
@ -9,37 +9,6 @@
|
|||||||
!blueprint_grid_outer_width = !blueprint_grid_width + !blueprint_grid_margin
|
!blueprint_grid_outer_width = !blueprint_grid_width + !blueprint_grid_margin
|
||||||
!blueprint_container_size = !blueprint_grid_outer_width * !blueprint_grid_columns - !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
|
// Columns
|
||||||
// Note: If you use this mixin without the class and want to support ie6
|
// 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.
|
// you must set text-align left on your container element in an IE stylesheet.
|
||||||
@ -54,13 +23,8 @@
|
|||||||
=last
|
=last
|
||||||
:margin-left 0
|
:margin-left 0
|
||||||
|
|
||||||
=span(!n)
|
=column-base(!last = false)
|
||||||
:width = !blueprint_grid_width * !n + (!blueprint_grid_margin * (!n - 1))
|
|
||||||
|
|
||||||
// Use this mixins to set the width of n columns.
|
|
||||||
=column(!n, !last = false)
|
|
||||||
+float-right
|
+float-right
|
||||||
+span(!n)
|
|
||||||
@if !last
|
@if !last
|
||||||
+last
|
+last
|
||||||
@else
|
@else
|
||||||
|
@ -12,6 +12,11 @@ module Sass::Script::Functions
|
|||||||
Sass::Script::String.new(nested)
|
Sass::Script::String.new(nested)
|
||||||
end
|
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)
|
def image_url(path)
|
||||||
http_images_path = if Compass.configuration.http_images_path == :relative
|
http_images_path = if Compass.configuration.http_images_path == :relative
|
||||||
if (target_css_file = options[:css_filename])
|
if (target_css_file = options[:css_filename])
|
||||||
|
Loading…
Reference in New Issue
Block a user