0
在mixin
或extend
中使用Less.js
中的變量將導致錯誤。在mixin上使用變量或在Less.js中使用變量
@bar : bar;
[email protected]{bar} {
background: yellow;
}
// ParseError: Missing closing ')'
.foo {
[email protected]{bar}();
}
// Not work
.jam {
&:extend([email protected]{bar});
}
擁有Less.js
正確的語法來調用mixin
與變量?
總之,沒有。在[#1485](https://github.com/less/less.js/issues/1485)中提出了'extend'的相應功能。 –
至於mixins - 現在不推薦重新使用現有的CSS規則集作爲mixin出於各種原因,所以這個功能沒有計劃(儘管它可能會間接受到其他附加支持)。因此,對於你的使用情況,你可能更好地從某種東西開始[像這樣](http://less2css.org/#%7B%22less%22%3A%22%40bar%20%3A%20bar%3B% 5CN%5Cn.style到複用()%20%7B%5CN%20%20%20%20background%3A%20yellow%3B%5CN%7D%5CN%5CN。%40%7Bbar%7D%20%7B %5CN%20%20%20%20.style到複用()%3B%5CN%7D%5CN%5Cn.foo%20%7B%5CN%20%20%20%20.style到複用()%3B%5CN%7D%5CN%22%7D)。 –