Add a boolean argument to the pull mixin that indicates wether you are pulling past the last column.

This commit is contained in:
Chris Eppstein 2008-09-13 23:52:04 -07:00
parent 975f06daa1
commit 95579a8e6b

View File

@ -1,148 +1,151 @@
// -------------------------------------------------------------- // --------------------------------------------------------------
// SASS Gridification // SASS Gridification
// * Author: Chris Eppstein // * Author: Chris Eppstein
// A SASS adaptation of Blueprint CSS // A SASS adaptation of Blueprint CSS
// * Version: 0.7.1 (2008-02-25) // * Version: 0.7.1 (2008-02-25)
// * Website: http://code.google.com/p/blueprintcss/ // * Website: http://code.google.com/p/blueprintcss/
// Based on work by: // Based on work by:
// * Lorin Tacket [lorintackett.com] // * Lorin Tacket [lorintackett.com]
// * Olav Bjorkoy [bjorkoy.com] // * Olav Bjorkoy [bjorkoy.com]
// * Nathan Borror [playgroundblues.com] // * Nathan Borror [playgroundblues.com]
// * Jeff Croft [jeffcroft.com] // * Jeff Croft [jeffcroft.com]
// * Christian Metts [mintchaos.com] // * Christian Metts [mintchaos.com]
// * Khoi Vinh [subtraction.com] // * Khoi Vinh [subtraction.com]
// Read more about using a grid here: // Read more about using a grid here:
// * subtraction.com/archives/2007/0318_oh_yeeaahh.php // * subtraction.com/archives/2007/0318_oh_yeeaahh.php
// -------------------------------------------------------------- // --------------------------------------------------------------
@import compass/utilities @import compass/utilities
// Main layout grid, edit these parameters to build your grid and container sizes. // Main layout grid, edit these parameters to build your grid and container sizes.
!layout_grid_columns = 24 !layout_grid_columns = 24
!layout_grid_width = 30px !layout_grid_width = 30px
!layout_grid_margin = 10px !layout_grid_margin = 10px
// Do not edit below this line unless you really know what you're doing. // Do not edit below this line unless you really know what you're doing.
!layout_grid_outer_width = !layout_grid_width + !layout_grid_margin !layout_grid_outer_width = !layout_grid_width + !layout_grid_margin
!layout_grid_size = !layout_grid_width * !layout_grid_columns + (!layout_grid_margin * (!layout_grid_columns - 1)) !layout_grid_size = !layout_grid_width * !layout_grid_columns + (!layout_grid_margin * (!layout_grid_columns - 1))
// 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.
=container =container
:width = !layout_grid_size :width = !layout_grid_size
:margin 0 auto :margin 0 auto
+clearfix +clearfix
// 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)
:width = !layout_grid_width * !n + (!layout_grid_margin * (!n - 1)) :width = !layout_grid_width * !n + (!layout_grid_margin * (!n - 1))
// Use this mixins to set the width of n columns. // Use this mixins to set the width of n columns.
=column(!n, !last = false) =column(!n, !last = false)
:float left :float left
+span(!n) +span(!n)
@if !last @if !last
+last +last
@if !!last @if !!last
:margin-right = !layout_grid_margin :margin-right = !layout_grid_margin
// Mixin to a column to append n empty cols. // Mixin to a column to append n empty cols.
=append(!n) =append(!n)
:padding-right = (!layout_grid_outer_width) * !n :padding-right = (!layout_grid_outer_width) * !n
// Mixin to a column to prepend n empty cols. // Mixin to a column to prepend n empty cols.
=prepend(!n) =prepend(!n)
:padding-left = (!layout_grid_outer_width) * !n :padding-left = (!layout_grid_outer_width) * !n
// mixin to a column to move it n columns to the left // mixin to a column to move it n columns to the left
=pull(!n) =pull(!n, !last = false)
:float left :float left
:position relative :position relative
:margin-left = -!layout_grid_outer_width * !n @if !last
:margin-left = (-!layout_grid_outer_width * !n) + !layout_grid_margin
// mixin to a column to push it n columns to the right @if !!last
=push(!n) :margin-left = -!layout_grid_outer_width * !n
:float right
:position relative // mixin to a column to push it n columns to the right
:margin =push(!n)
:top 0 :float right
:right = -!layout_grid_outer_width * !n :position relative
:bottom 1.5em :margin
:left = -!layout_grid_outer_width * !n :top 0
:right = -!layout_grid_outer_width * !n
// Border on right hand side of a column. :bottom 1.5em
=border :left = -!layout_grid_outer_width * !n
:padding-right = !layout_grid_margin / 2 - 1
:margin-right = !layout_grid_margin / 2 // Border on right hand side of a column.
:border-right 1px solid #eee =border
:padding-right = !layout_grid_margin / 2 - 1
// Border with more whitespace, spans one column. :margin-right = !layout_grid_margin / 2
=colborder :border-right 1px solid #eee
:padding-right= !layout_grid_width - 0.5 * !layout_grid_margin - 1
:margin-right= !layout_grid_width - 0.5 * !layout_grid_margin // Border with more whitespace, spans one column.
:border-right 1px solid #eee =colborder
:padding-right= !layout_grid_width - 0.5 * !layout_grid_margin - 1
// Mixin this to an hr to make a horizontal ruler across a column. :margin-right= !layout_grid_width - 0.5 * !layout_grid_margin
=colruler :border-right 1px solid #eee
:background #ddd
:color #ddd // Mixin this to an hr to make a horizontal ruler across a column.
:clear both =colruler
:float none :background #ddd
:width 100% :color #ddd
:height .1em :clear both
:margin 0 0 1.45em :float none
:border none :width 100%
:height .1em
// Mixin this to an hr to make a horizontal spacer across a column. :margin 0 0 1.45em
=colspacer :border none
+colruler
:background #fff // Mixin this to an hr to make a horizontal spacer across a column.
:color #fff =colspacer
+colruler
=blueprint-grid :background #fff
// A container should group all your columns :color #fff
.container
+container =blueprint-grid
// Use these classes (or mixins) to set the width of a column. // A container should group all your columns
@for !n from 1 to !layout_grid_columns + 1 .container
.span-#{!n} +container
+span(!n) // Use these classes (or mixins) to set the width of a column.
div @for !n from 1 to !layout_grid_columns + 1
&.span-#{!n} .span-#{!n}
+column(!n, !n == !layout_grid_columns) +span(!n)
// The last column in a row needs this class (or mixin) or it will end up on the next row. div
div.last &.span-#{!n}
+last +column(!n, !n == !layout_grid_columns)
// Add these to a column to append empty cols. // The last column in a row needs this class (or mixin) or it will end up on the next row.
@for !n from 1 to !layout_grid_columns div.last
.append-#{!n} +last
+append(!n) // Add these to a column to append empty cols.
// Add these to a column to prepend empty cols. @for !n from 1 to !layout_grid_columns
@for !n from 1 to !layout_grid_columns .append-#{!n}
.prepend-#{!n} +append(!n)
+prepend(!n) // Add these to a column to prepend empty cols.
// Use these classes on an element to push it into the @for !n from 1 to !layout_grid_columns
// next column, or to pull it into the previous column. .prepend-#{!n}
@for !n from 1 to !layout_grid_columns + 1 +prepend(!n)
.pull-#{!n} // Use these classes on an element to push it into the
+pull(!n) // next column, or to pull it into the previous column.
@for !n from 1 to !layout_grid_columns + 1 @for !n from 1 to !layout_grid_columns + 1
.push-#{!n} .pull-#{!n}
+push(!n) +pull(!n)
//*** The following classes are provided for convenience. You can comment them out if you don't want them. ***// @for !n from 1 to !layout_grid_columns + 1
// Border on right hand side of a column. You can comment this out if you don't plan to use it. .push-#{!n}
div.border +push(!n)
+border //*** The following classes are provided for convenience. You can comment them out if you don't want them. ***//
// Border with more whitespace, spans one column. // Border on right hand side of a column. You can comment this out if you don't plan to use it.
div.colborder div.border
+colborder +border
hr // Border with more whitespace, spans one column.
+colruler div.colborder
hr.space +colborder
+colspacer hr
+colruler
hr.space
+colspacer