gpt4 book ai didi

javascript - 使用 !important 时 gulp-less 失败

转载 作者:太空宇宙 更新时间:2023-11-03 19:25:17 27 4
gpt4 key购买 nike

当我们在特定的 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

最佳答案

可能是你的变量 @wrapper-height 被连字符了。

尝试使用类似 @wrapperHeight 的 var 名称,看看 Gulp 如何处理它。

更新:实际上,您正在尝试导入 basefile 而不是 basefile.less - 尝试添加 .less 文件扩展名。

关于javascript - 使用 !important 时 gulp-less 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57568988/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com