首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用时gulp-less失败!重要

使用时gulp-less失败!重要
EN

Stack Overflow用户
提问于 2019-08-20 15:53:10
回答 1查看 90关注 0票数 0

当我们在特定的less变量上使用!important时,构建会失败。我们到处都在使用!important,我不知道这一次有什么不同。

设置:

customer1.less

代码语言:javascript
复制
@import "basefile";

@wrapper-height: auto !important;
...

basefile.less

代码语言:javascript
复制
@import 'variables/basefile-variables';
...

basefile-variables.less

代码语言:javascript
复制
@wrapper-height: auto;
...

运行gulp-less时出错:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2019-08-20 16:16:37

可能是您的变量@wrapper-height用连字符连接了。

尝试一个var名称,比如@wrapperHeight,看看Gulp是如何处理的。

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

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57568988

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档