我正在寻求这样做。但我得到一个解析错误。 LESS可以实现吗?
密新:
.fa-icon(@fa-pseudo-postion, @fa-icon, @fa-font-size, @fa-display-value) {
&:@{fa-pseudo-postion} {
content: @fa-icon;
font-family: FontAwesome;
font-size: @fa-font-size;
display: @fa-display-value;
}
}
使用中:
.fa-icon(before, @fa-plus, 16px, inline);
答案 0 :(得分:2)
修复this bug之前的解决方法。
.fa-icon(@fa-pseudo-position, @fa-icon, @fa-font-size, @fa-display-value) {
@pseudo-position: ~":@{fa-pseudo-position}"; // Workaround for this bug (https://github.com/less/less.js/issues/1294) remove when fixed
&@{pseudo-position} {
content: @fa-icon;
font-family: FontAwesome;
font-size: @fa-font-size;
display: @fa-display-value;
}
}