Twitter bootstrap 3 VS2013中无引导变量-智能感知和未声明变量失败
为什么Intellisense不适用于无引导变量 问题是:Twitter bootstrap 3 VS2013中无引导变量-智能感知和未声明变量失败,twitter-bootstrap-3,visual-studio-2013,less,web-essentials,Twitter Bootstrap 3,Visual Studio 2013,Less,Web Essentials,为什么Intellisense不适用于无引导变量 问题是:@gray,以及variables.less中的任何其他变量,在引导.less中引用,会用“Undeclared variable”错误下划线,但less会按预期编译为CSS,并且颜色正确设置为#555555 正如中所说,这与其说是个问题,不如说是个麻烦,因为Intellisense丢失了,每个变量都必须在没有Intellisense帮助的情况下被键入和记住 与上面提到的问题不同,我使用的是VS2013和Web Essentials 20
@gray
,以及variables.less
中的任何其他变量,在引导.less
中引用,会用“Undeclared variable”错误下划线,但less会按预期编译为CSS,并且颜色正确设置为#555555
正如中所说,这与其说是个问题,不如说是个麻烦,因为Intellisense丢失了,每个变量都必须在没有Intellisense帮助的情况下被键入和记住
与上面提到的问题不同,我使用的是VS2013和Web Essentials 2013,它们都在今天更新,但问题仍然存在
有没有关于如何解决这个问题的建议
代码更少
// _MasterLayout.LESS
@import "/bootstrap/bootstrap.less";
@header-height: 120px;
@footer-height: 240px;
html {
height: 100%;
color: @gray;
}
header {
position: relative;
height: @header-height;
// ...
...
html {
height: 100%;
color: #555555;
}
...
// _MasterLayout.LESS
/// <reference path="/bootstrap/variables.less" />
html {
color: @grey; // Should have intellisense now.
}
CSS生成的代码
// _MasterLayout.LESS
@import "/bootstrap/bootstrap.less";
@header-height: 120px;
@footer-height: 240px;
html {
height: 100%;
color: @gray;
}
header {
position: relative;
height: @header-height;
// ...
...
html {
height: 100%;
color: #555555;
}
...
// _MasterLayout.LESS
/// <reference path="/bootstrap/variables.less" />
html {
color: @grey; // Should have intellisense now.
}
您可以向less文件添加引用路径。这与js文件中的工作方式相同,为该文件提供intellisense 因此,对于您的情况,您需要引用bootstrap variables.less文件 示例
// _MasterLayout.LESS
@import "/bootstrap/bootstrap.less";
@header-height: 120px;
@footer-height: 240px;
html {
height: 100%;
color: @gray;
}
header {
position: relative;
height: @header-height;
// ...
...
html {
height: 100%;
color: #555555;
}
...
// _MasterLayout.LESS
/// <reference path="/bootstrap/variables.less" />
html {
color: @grey; // Should have intellisense now.
}
/\u MasterLayout.LESS
///
html{
颜色:@grey;//现在应该有智能感知了。
}
您可以向less文件添加引用路径。这与js文件中的工作方式相同,为该文件提供intellisense
因此,对于您的情况,您需要引用bootstrap variables.less文件
示例
// _MasterLayout.LESS
@import "/bootstrap/bootstrap.less";
@header-height: 120px;
@footer-height: 240px;
html {
height: 100%;
color: @gray;
}
header {
position: relative;
height: @header-height;
// ...
...
html {
height: 100%;
color: #555555;
}
...
// _MasterLayout.LESS
/// <reference path="/bootstrap/variables.less" />
html {
color: @grey; // Should have intellisense now.
}
/\u MasterLayout.LESS
///
html{
颜色:@grey;//现在应该有智能感知了。
}
由于编译是正常的,我不知道为什么Intellisense在给定的代码中失败,但是,下面的解决方案将修复它
考虑到以下文件结构:
- Content
- bootstrap
- bootstrap.less
- variables.less
- anythingelse.less
- master.less
不要在引导文件夹之前使用/
导入:
// _MasterLayout.LESS
@import "/bootstrap/bootstrap.less";
导入时不使用/
引导前文件夹:
// _MasterLayout.LESS
@import "bootstrap/bootstrap.less";
由于编译是正常的,我不知道为什么Intellisense在给定的代码中失败,但是,下面的解决方案将修复它 考虑到以下文件结构:
- Content
- bootstrap
- bootstrap.less
- variables.less
- anythingelse.less
- master.less
不要在引导文件夹之前使用/
导入:
// _MasterLayout.LESS
@import "/bootstrap/bootstrap.less";
导入时不使用/
引导前文件夹:
// _MasterLayout.LESS
@import "bootstrap/bootstrap.less";
Bootstrap利用了先进的、没有“前沿”的功能。VisualStudio根本无法解析这些文件,因此出现故障。在不太稳定(在语法和/或语义上)之前,我不希望它能够处理这些巨大的风格框架。VisualStudio根本无法解析这些文件,因此出现故障。在不太稳定(语法和/或语义)之前,我不希望它能够处理这些巨大的风格框架。谢谢你的帮助,但它也不起作用…:(好消息是,我已经解决了!:)我现在就发布答案!谢谢你的帮助,但它也不起作用…:(好消息是,我已经解决了!:)我现在就发布答案!