The #{} interpolation syntax is not valid in a script context. It's used for
creating a script context within a string or non-script context. Note that =
also creates a script context.

Also, since sass understands units. I would write this like and accept
arguments with units on them.

=mixin(!arg1, !pos_x, !pos_y)
  li#act-#{!arg1}
    :left= !pos_x
    :top= !pos_y
    &:hover
      :left = !pos_x - 50px
      :top = !pos_y - 100px

+mixin("foo", 100px, 200px)

I think this makes it easier to understand when the mixin is used and read.
It generates the following css:

li#act-foo {
  left: 100px;
  top: 200px; }
  li#act-foo:hover {
    left: 50px;
    top: 100px; }


Chris

On Sat, Aug 29, 2009 at 11:01 AM, rvr <[email protected]> wrote:

>
> is there a way to perform a math operation with a mixin argument? i
> can't figure out the syntax to get a result. here's what i'm trying to
> do:
>
> =mixin(!arg1, !pos_x, !pos_y)
>  li#act-#{!arg1}
>    :left #{!pos_x}px
>    :top #{!pos_y}px
>    &:hover
>      :left = #{!pos_x}px - 50px
>      :top = #{!pos_y}px - 100px
>
> that throws an error because it doesn't like the interpolation token
> at the beginning i 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to