ashays
ashays

Reputation: 1154

Arguments not working properly in SASS @mixin

I've been using sass (specifically the scss bit) with my spreadsheets, and until now it had been going well. I use quite a few CSS3 features that aren't fully implemented yet in all browsers, and I figured that I could just write a mixin that did something to this extent:

@mixin multilang($what, $value) {
    $what: $value;
    -khtml-#{$what}: $value;
    -webkit-#{$what}: $value;
    -o-#{$what}: $value;
    -moz-#{$what}: $value;
}

And call it like @include multilang(user-select, none);, but instead, my compiled CSS is littered with things like -khtml-none: none, etc.

Now, I figure I'm just doing something wrong here, but I can't quite seem to figure out what it is. I tried putting quotes around things, using named arguments, etc., but everything basically has the same problem.

Upvotes: 3

Views: 910

Answers (1)

halliewuud
halliewuud

Reputation: 2785

you need to wrap your first $what like this

@mixin multilang($what, $value) {
  #{$what}: $value;
  -khtml-#{$what}: $value;
  -webkit-#{$what}: $value;
  -o-#{$what}: $value;
  -moz-#{$what}: $value;
}

Upvotes: 2

Related Questions