当LESS变量值转换为字符串时删除空格 [英] Remove space when LESS variable value to string
本文介绍了当LESS变量值转换为字符串时删除空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是示例较少的混合代码
Below is example less mixin code
.mixin(@option) {
.set(@options) when (@options = a){
@type: linear;
}
.set(@option);
background: -webkit-~'@{type}'-gradient(...);
}
输出
background: -webkit- linear -gradient(...);
如何删除 linear
周围的空间?
推荐答案
Less不支持在值语句中通过变量插值进行就地串联.为此,您需要一个临时变量(在这种情况下,需要一个辅助变量来处理parens),例如:
Less does not support an inplace concatenation via variable interpolation in value statements. You need a temporary variable for this (+ an auxiliary variable in this particular case to handle parens), e.g.:
@end-func: ~')';
div {
@func: ~'-webkit-@{type}-gradient(';
background: @func ... @end-func;
}
这篇关于当LESS变量值转换为字符串时删除空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文