LESS 正在乘以 mixin 的输出
我有一个像这样的 mixin:
#font {
.set-size(@size: 14px, @spacing: 1.5) {
font-size: @size;
line-height: @size * @spacing;
}
我从另一个样式表中调用它,就像这样:
h1 {
#font > .set-size(24px);
}
然后编译器输出:
h1{font-size:24px;line-height:36px;font-size:24px;line-height:36px;font-size:24px;line-height:36px;}
正如您所看到的,它多次重复输出。有谁知道为什么会出现这种情况?我尝试从命令行使用 less.app 和 lessc ,结果完全相同。
I have a mixin like this one:
#font {
.set-size(@size: 14px, @spacing: 1.5) {
font-size: @size;
line-height: @size * @spacing;
}
And I call it from another stylesheet, like this one:
h1 {
#font > .set-size(24px);
}
And then the compiler outputs:
h1{font-size:24px;line-height:36px;font-size:24px;line-height:36px;font-size:24px;line-height:36px;}
As you can see it repeats the output several times. Anyone knows why this occurs? I've tried with less.app and lessc from the command line with exactly the same result.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在尝试编译您的包时遇到错误,因为它缺少大括号。
修复后我能够成功编译,并且只输出一次值。我的代码是这样的:
输出如下:
I got an error trying to compile your bundle because it was missing a curly bracket.
I was able to successfully compile after that fix and it only output the values once. My code was as such:
which output this: