0

here i want to create a less mixin. The parameter is brand and is should be changed into [email protected]. The code below did not work.

.bglogo (@brand) {
  @brandurl: @brand + '@2x.png';
  background-image: url(@brandurl);
}

.span{
  .bglogo('brand');
}

error message --

enter image description here

1

1 Answer 1

1

You need to use variable interpolation in order to concatenate the variable and the string.

In your case, you would use the value "@{brand}@2x.png":

.bglogo (@brand) {
  @brandurl: "@{brand}@2x.png";
  background-image: url(@brandurl);
}

.span {
  .bglogo('brand');
}

Result:

.span {
  background-image: url("[email protected]");
}
1
  • It works. Here I mistake it with stylus...Thank you!
    – erikyu
    Feb 18, 2017 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.