在使用带有字体速记的 Less 时,我注意到了一个问题
.font(@weight: 300, @size: 22px, @height: 32px) {
font: @weight @size/@height "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif;
}
以上失败了
this.a.toCSS is not a function
http://localhost/tumblr/modern1/css/style.less on line 1, column 0:
1. @highlight: #cb1e16;
2. @shade1: #cb1e16;
当我拆分属性时,它可以工作
.font(@weight: 300, @size: 22px, @height: 32px) {
font-weight: @weight;
font-size: @size;
line-height: @height;
font-family: "Yanone Kaffeesatz", "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif;
}
我认为这是因为斜线/那是导致问题的原因,我认为因为 Less 可以进行计算,例如。2px + 5 = 7px
它试图分道扬镳?