Hi,

I have a problem to understand how variables work:

I have this code:

@mixin foo {
        $val: 'red' !default;
        .bar {
                color: $val;
        }
}
@include foo;
.class1 {
        $val: 'green';
        @include foo;
        .class11 {
                @include foo;
        }
}
$val: 'black';
.class2 {
        @include foo;
}
.class3 {
        $val: 'blue';
        @include foo;
}
.class4 {
        @include foo;
}


And it produces the CSS:

.bar {
  color: "red";
}
.class1 .bar {
  color: "red";
}
.class1 .class11 .bar {
  color: "red";
}
.class2 .bar {
  color: "black";
}
.class3 .bar {
  color: "blue";
}
.class4 .bar {
  color: "blue";
}


Why $var in .class1 did not get the value of 'green'.

And when you define outside of the bracket, then applies the new
values​​. example .class3

Can I somehow assign default value to a variable as I have already
given the variable another value after.

-- 
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.

Reply via email to