私はこれをLESS Webサイトのドキュメント、ミックスイン部分に従って書きました。これは機能すると思いましたが、構文エラーが発生します。
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 }
レスは次のとおりです。
.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()
また、複数のパラメーターのみを使用すると、同じエラーが発生します。
SyntaxError: properties must be inside selector blocks, they cannot be in the
root. in less/style.less on line 14, column 3:
13 .mydiv(@width:300px; @height: 155px) {
14 background-position: 0px -52px;
15 width: @width;
以下:
.mydiv (@width:300px; @height: 155px) {
background-position: 0px -52px;
width: @width;
height: @height;
opacity: 1;
}
.mydiv()
何が問題なのかわからない...助けてください...
引用:Windows 8.1 x64で、grunt-contrib-lessとless 1.4.2を使用しています。