You cannot dynamically construct variables. In sass 3.1 there's a new
function called `if` so you can do this:
width: if($orientation == portrait, $portrait_width, $landscape_width);
chris
On Thu, Apr 14, 2011 at 1:32 AM, Victor Nystad vnys...@gmail.com wrote:
I'm writing a mixin for a grid for an iPad app, where the orientation of
the iPad determines the property values.
To avoid unnecessary repetition I'd like to use dynamic variable names.
Lets say I have two variables:
$portrait_width: 600px;
$landscape_width: 900px;
And then the mixin:
@mixin grid($orientation) {
.#{$orientation} {
width: #{'$' + (#{$orientation}_width)};
}
}
Usage:
@include grid(portrait);
@include grid(landscape);
This simply outputs the variable name and not the value:
.portrait {
width: $portrait_width;
}
.landscape {
width: $landscape_width;
}
I've tried all the combinations I can think of in the mixin, but can't get
this to work.
Is this possible at all?
--
You received this message because you are subscribed to the Google Groups
Haml group.
To post to this group, send email to haml@googlegroups.com.
To unsubscribe from this group, send email to
haml+unsubscr...@googlegroups.com.
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 haml@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.