【发布时间】:2019-08-20 07:53:10
【问题描述】:
当我们对特定的 less 变量使用 !important 时,构建会失败。我们在所有地方都使用 !important,我不知道是什么让这个有什么不同。
设置:
customer1.less
@import "basefile";
@wrapper-height: auto !important;
...
basefile.less
@import 'variables/basefile-variables';
...
basefile-variables.less
@wrapper-height: auto;
...
运行 gulp-less 时出错:
Error in plugin "gulp-less"
Message:
Cannot create property '_index' on string '!important' in file /<redacted>/customer1.less line no. 1
Details:
type: Syntax
filename: /<redacted>/customer1.less
index: NaN
line: 1
column: -1
callLine: NaN
callExtract: undefined
extract: ,@import "basefile";,
lineNumber: 1
fileName: /<redacted>/customer1.less
【问题讨论】:
-
我今天遇到了类似的问题,在特定机器上编译失败并显示相同的消息。在这种情况下,从有问题的文件中找到的两个地方删除“!important”属性解决了这个问题。 gulp-less 4.0.1.
-
@swalladge 是的,这就是我们最终要做的,但在 gulp-less 中肯定存在某种错误。
标签: javascript css gulp less