Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String interpolation & Parametric Mixins bug #272

Closed
Pym opened this issue May 19, 2011 · 2 comments
Closed

String interpolation & Parametric Mixins bug #272

Pym opened this issue May 19, 2011 · 2 comments

Comments

@Pym
Copy link

Pym commented May 19, 2011

I'm using less.js 1.1.0.

Considering the following lines of code:

.state-icon(@icon) {
  background: url("../images/icons/colors/@{icon}") no-repeat;
}
.step-state {
  &.state-0 {.state-icon("green.png")}
  &.state-1 {.state-icon("yellow.png")}
  &.state-2 {.state-icon("orange.png")}
  &.state-3 {.state-icon("red.png")}
}

It will be converted like that:

.step-state.state-0 {
    background: url(../images/icons/colors/green.png) no-repeat;
}
.step-state.state-1 {
    background: url(../images/icons/colors/green.png) no-repeat;
}
.step-state.state-2 {
    background: url(../images/icons/colors/green.png) no-repeat;
}
.step-state.state-3 {
    background: url(../images/icons/colors/green.png) no-repeat;
}

The problem here is that all of my states are green.

Maybe I did something wrong?

Thanks!

@Pym
Copy link
Author

Pym commented May 19, 2011

Even this single piece of code will produce the same result:

.icon(@icon: "default") {background: url("@{icon}.png")}
#toto {.icon("green")}
#tata {.icon}
#titi {.icon("red")}

Will be converted into:

#toto {
  background: url("green.png");
}
#tata {
  background: url("green.png");
}
#titi {
  background: url("green.png");
}

The problem looks like that the result of the mixin is always the one of the first call.

@cloudhead
Copy link
Member

This is indeed a bug, fixing in a sec! It will be in 1.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants