The way this is often done is to put the grid and column mixins in their own
partial (e.g. _grid.sass). In this file, you define a $number-of-columns
variable at top-level using the !default flag. Then when you can optionally
set $number-of-columns before you import the file, which will override the
default. Here's an example: http://gist.github.com/526665

It's also worth noting that Sass variables can have units. This means that
your width expression might be better written as "$width *
960px/$number-of-columns".

- Nathan

On Mon, Aug 16, 2010 at 1:23 AM, DAZ <[email protected]> wrote:

> I'm playing around with a basic grid layout
>
> @mixin grid($number-of-columns: 12)
>
> @mixin column($width)
>  width: #{$width * 960/@number-of-columns}px
>
> As you can see, I want the column mixin to have access to the $number-
> of-columns variable that is set in the grid mixin
>
> The idea would be to do something like this:
>
> #container
>  +grid
>  #sidebar
>   +column(4)
>  #main
>   +column(8)
>
> The columns *have* to be nested within a grid, is there anyway to
> connect mixins in such a way?
>
> cheers,
>
> DAZ
>
> --
> You received this message because you are subscribed to the Google Groups
> "Haml" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <haml%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/haml?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to