Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LESS CSS pass string to mixin

Tags:

css

mixins

less

I am trying to pass something like this to a mixin

.myMixin(Pdcbs/sjdhc+jdjhdf);

This fails when compiling, syntax error

I tried wrapping the string in quotes but in the output I see my parameter get outputted like

background: ...@{paramName}

I tried ~"stringhere"... I been on this for hours now Please point me to the right direction, thanks

like image 839
Huangism Avatar asked Sep 15 '25 11:09

Huangism


1 Answers

I'm not quite certain what you are seeking to have as output, but this:

.mixin(@paramName) {
  background: ~"...@{paramName}";
}

.mixin("Pdcbs/sjdhc+jdjhdf");

Produces this for me:

background: ...Pdcbs/sjdhc+jdjhdf;
like image 157
ScottS Avatar answered Sep 17 '25 04:09

ScottS