import - Web Essentials 2012 减少导入

标签 import visual-studio-2012 less web-essentials

有 2 个文件,我想将变量样式表导入到第二个文件,但在第一种情况下,我在预览模式下遇到语法不正确错误,在第二种情况下,我遇到未声明的变量> 错误。无论如何,两种情况都编译正确。

预览模式错误的第一种情况:

变量.less:

@color-background: rgb(0, 0 , 0);

style1.less:

@import 'variables.less';
div
{
    color:@color-background;
} 

第二种情况,未声明变量错误:

变量.less:

html{color:red;}
@color-background: rgb(0, 0 , 0);

style1.less:

html{color:red;}
@import 'variables.less';
div
{
    color:@color-background;
} 

html{color:red} 只是修复了预览模式。它可以是任何有效的 html。

问题是我只能使用 html 标签启动文件以获得预览模式,但不能使用注释或导入指令。

最佳答案

这是 Web Essentials 中 LESS 编辑器中的错误。要解决这个问题,请始终将 @import 指令放在文档的顶部。

触发此问题的原因是您在 @import 指令之前添加了:html{color:red;}。

此问题将在即将发布的 Web Essentials 版本中得到修复。不过,还没有日期。

关于import - Web Essentials 2012 减少导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14167773/

相关文章:

java - 无法在 Eclipse 中解析 import com.sun.javadoc

javascript - 使用 block 导入/加载库

c++ - openCV 说找不到相机

html - 边缘 40/15 不透明度/可见性过渡事件传播(闪烁)错误?

compiler-construction - Less不能使用Twitter Bootstrap编译文件

javascript - 水平折叠输入显示 : flex

PYTHON 文件更新在 VSCODE 中导入时未反射(reflect)出来

android - 错误 :Newer :Execution failed for task ':app:dexDebug' . com.android.ide.common.process.ProcessException

c++ - std::function 复制运算符的奇怪行为 (MSVC2012)

.net - Word VSTO 4.0 插件无法加载 : Could not load file or assembly