小编zha*_*x93的帖子

具有多个参数的LESS mixins会引发语法错误

我写了这个跟随LESS网站的文档,mixins部分,我认为它可以工作,但引发语法错误:

SyntaxError: properties must be inside selector blocks, they cannot be in the
root. in less/style.less on line 3, column 3:  
2 .bg (@x; @y) {  
3   background-position: unit(@x, px) unit(@y, px);  
4 }
Run Code Online (Sandbox Code Playgroud)

这是Less:

.bg (@x; @y) {
  background-position: unit(@x, px) unit(@y, px);
}
.mydiv (@x:0; @y:-52; @width:300px; @height: 155px) {
  .bg(@x, @y);
  width: @width;
  height: @height;
  opacity: 1;
}

.mydiv()
Run Code Online (Sandbox Code Playgroud)

另外,如果我只使用多个参数,则会导致相同的错误:

SyntaxError: properties must be inside selector blocks, they cannot be in the  
root. in less/style.less on line …
Run Code Online (Sandbox Code Playgroud)

css less gruntjs

2
推荐指数
1
解决办法
2633
查看次数

标签 统计

css ×1

gruntjs ×1

less ×1