Mixins can take an argument like so: =border($background-color) border: 1px solid darken($background-color, 10%)
And then used like so: .style +border($green) Also, underscores are allowed in variable names (they are equivalent to dashes). Chris On Wed, Apr 14, 2010 at 4:34 AM, Jesse Dodds <[email protected]> wrote: > Awesome! I was sure I tried that at first, but just realised my > original naming of the variables had underscores, which seemed doing > something weird. > > Another thing i was wondering was if something like this was possible: > > > =border > border: 1px solid darken($background-color, 10%) > > Where $backround is pulled from eg: > > .style > background-color: $green > +border > > .styleAlt > background-color: $blue > +border > > Cheers > > > On Apr 14, 6:52 pm, Nathan Weizenbaum <[email protected]> wrote: > > You should almost never need to use interpolation when assigning a > > variable or using it in a property. Just include the variable > > directly, like so: > > > > $green: #b5d446 > > $greenLighter: lighten($green, 5%) > > $greenDarker: darken($green, 10%) > > > > If you use interpolation, Sass will convert the variable to a string. > > > > > > > > On Wed, Apr 14, 2010 at 12:34 AM, Jesse Dodds <[email protected]> > wrote: > > > This is probably a rookie mistake, but my head is being done in. > > > > > $green: #b5d446 > > > $greenLighter: lighten(#{$green}, 5%) > > > $greenDarker: darken(#{$green}, 10%) > > > > > After looking through the documentation, I assumed this would work, > > > however it throws the error: Sass Error: "#b5d446" is not a color for > > > `lighten'. The thing is, it works if i directly insert the hex code in > > > place of the interpolated variable. *headdesk* > > > > > Any help would be appreciated. > > > > > Cheers, > > > Jesse > > > > > -- > > > 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 athttp:// > 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] <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.
