oops, didn't notice you were using interpolation in your mixin. On Sat, Dec 20, 2008 at 10:13 PM, Evgeny <[email protected]> wrote:
> and mixins work in stable, right?so basically I can use this right now ... > > > On Sat, Dec 20, 2008 at 7:57 PM, Chris Eppstein <[email protected]>wrote: > >> This feature already exists on the master branch. You can use ruby-style >> interpolation escapes like so: >> div .#{!foobar} >> :color blue >> >> However, I would recommend that you turn this into a mixin: >> >> =floated-icon(!direction = "left", !margin = 20px) >> !ndirection = "right" >> @if !direction != "left" >> !ndirection = "left" >> :float = !direction >> :margin >> :#{!ndirection}= -!margin >> >> >> Then you can apply this to your selectors: >> img.icon >> +floated-icon("left") >> img#logo >> +floated-icon("right") >> >> Chris >> >> P.S. For a real world example of some of the newest sass features you can >> look at compass's blueprint grid >> module<http://github.com/chriseppstein/compass/tree/master/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass> >> . >> >> >> On Sat, Dec 20, 2008 at 7:09 AM, Evgeny <[email protected]> wrote: >> >>> I would love to see sass use constants in selectors, not just in values; >>> One example would be to use a constant for a "class" name, example: >>> >>> !foobar = 'cafe' >>> >>> div .!foobar >>> :color blue >>> >>> ul li a img .!foobar >>> :border-color: blue >>> >>> >>> Another example (and actually the reason why I want this): >>> >>> !direction = left >>> !ndirection = right >>> >>> img.icon >>> :float = !direction >>> :margin >>> :!ndirection -20px >>> >>> >>> So if I want to generate my css to be right-to-left I use >>> !direction=right, the other way around - !direction=left. >>> When these constants are in an import file, this gives flexibility to >>> create BiDi css by generating the same sass files with different constants. >>> >>> >>> >>> What do you think? >>> >>> >>> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
