简体   繁体   English

较少的CSS将字符串传递给mixin

[英]LESS CSS pass string to mixin

I am trying to pass something like this to a mixin 我试图将这样的东西传递给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 我试过〜“stringhere”......我已经在这几个小时了,请指出正确的方向,谢谢

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM