瀏覽Twitter Bootstrap的2.0-wip分支,我發現LESS有一個綁定變量和mixin的好方法。請參閱下面的示例代碼:什麼是LESS命名空間的SCSS等價物,捆綁類
#font {
#family {
.serif() {
font-family: Georgia, "Times New Roman", Times, serif;
}
.sans-serif() {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.monospace() {
font-family: Menlo, Monaco, Courier New, monospace;
}
}
.shorthand(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
font-size: @size;
font-weight: @weight;
line-height: @lineHeight;
}
.serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
#font > #family > .serif;
#font > .shorthand(@size, @weight, @lineHeight);
}
.sans-serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
#font > #family > .sans-serif;
#font > .shorthand(@size, @weight, @lineHeight);
}
.monospace(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
#font > #family > .monospace;
#font > .shorthand(@size, @weight, @lineHeight);
}
}
什麼是SCSS當量?我如何在SCSS中重寫上述內容?
有沒有更新?它的2016 – harshitgupta 2016-07-23 15:38:29
哦!這是多年前的一個主題。順便說一句,這是在Sass的命名空間的想法 - https://changelog.com/namespace-support-is-being-added-to-sass/ – Brajeshwar 2016-07-25 03:13:28