Css 为什么这段代码没有编译?
我提取了这段较少的代码,这段代码导致web应用程序在运行异步任务以编译较少的代码时抛出错误。我以前写的东西从来没有少过,从我最初阅读的文档中,我似乎找不到哪里出了问题。有人知道怎么了吗? 这就是错误:Css 为什么这段代码没有编译?,css,less,Css,Less,我提取了这段较少的代码,这段代码导致web应用程序在运行异步任务以编译较少的代码时抛出错误。我以前写的东西从来没有少过,从我最初阅读的文档中,我似乎找不到哪里出了问题。有人知道怎么了吗? 这就是错误: ParseError: Unrecognised input in /Users/****/Desktop/testmoreless.css on line 4, column 3: 3 4 .core (@gridColumnWidth, @gridGutterWidth) { 5 这是完
ParseError: Unrecognised input in /Users/****/Desktop/testmoreless.css on line 4, column 3:
3
4 .core (@gridColumnWidth, @gridGutterWidth) {
5
这是完整的代码:
#grid {
.core (@gridColumnWidth, @gridGutterWidth) {
.spanX (@index) when (@index > 0) {
(~".span@{index}") { .span(@index); }
.spanX(@index - 1);
}
.spanX (0) {}
.offsetX (@index) when (@index > 0) {
(~".offset@{index}") { .offset(@index); }
.offsetX(@index - 1);
}
.offsetX (0) {}
.offset (@columns) {
margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)) + (@gridGutterWidth * 2);
}
.span (@columns) {
width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
}
.row {
margin-left: @gridGutterWidth * -1;
.clearfix();
}
[class*="span"] {
float: left;
margin-left: @gridGutterWidth;
}
// Set the container width, and override it for fixed navbars in media queries
.container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container { .span(@gridColumns); }
// generate .spanX and .offsetX
.spanX (@gridColumns);
.offsetX (@gridColumns);
}
.fluid (@fluidGridColumnWidth, @fluidGridGutterWidth) {
.spanX (@index) when (@index > 0) {
(~"> .span@{index}") { .span(@index); }
.spanX(@index - 1);
}
.spanX (0) {}
.span (@columns) {
width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1));
}
.row-fluid {
width: 100%;
.clearfix();
> [class*="span"] {
float: left;
margin-left: @fluidGridGutterWidth;
}
> [class*="span"]:first-child {
margin-left: 0;
}
// generate .spanX
.spanX (@gridColumns);
}
}
.input(@gridColumnWidth, @gridGutterWidth) {
.spanX (@index) when (@index > 0) {
(~"input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index}") { .span(@index); }
.spanX(@index - 1);
}
.spanX (0) {}
.span(@columns) {
width: ((@gridColumnWidth) * @columns) + (@gridGutterWidth * (@columns - 1)) - 10;
}
input,
textarea,
.uneditable-input {
margin-left: 0; // override margin-left from core grid system
}
// generate .spanX
.spanX (@gridColumns);
}
}
看看这个
逐字引用答案:
这是文件最初的内容:
(~".span@{index}") { .span(@index); }
在阅读之后,我发现他们更改了语法,因此您现在可以直接使用变量,而无需~hack。因此,我将我的mixin.less
更改为如下:
.span@{index} { .span(@index); }
还有几行需要更改,但它们都遵循相同的格式
(~“.offset@{index}”){.offset(@index);}
更改为→ .offset{index}{.offset(@index);}
请您也包括您的变量数据(即@gridColumnWidth:XXXX)