Visual Studio 2013 可以从 .less 文件生成 CSS 文件吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19855426/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can Visual Studio 2013 generate CSS files from .less files?
提问by Lucian
Visual Studio 2013 is awesome, now with syntax highlight and autocomplete for .less
files. But does it also generate the respective CSS files? Do I need to install other extensions for that?
Visual Studio 2013 很棒,现在具有语法突出显示和.less
文件自动完成功能。但它是否也生成了相应的 CSS 文件?我需要为此安装其他扩展吗?
采纳答案by BoltClock
Yes, Visual Studio 2013 doesn't come with a LESS compiler built-in so you'll need to bring your own. You can either use an external compiler, or install an extension so you can compile your LESS files from within the IDE.
是的,Visual Studio 2013 没有内置 LESS 编译器,因此您需要自带。您可以使用外部编译器,也可以安装扩展,以便从 IDE 中编译 LESS 文件。
回答by Wellington Zanelli
If you don't want to install plugins in your Visual Studio, you can use an external compiler.
如果不想在 Visual Studio 中安装插件,可以使用外部编译器。
Currently I'm using Koala, every time you save your LESS file he will compile it automatically in your output folder.
目前我正在使用Koala,每次您保存 LESS 文件时,他都会在您的输出文件夹中自动编译它。
Take a look at the official LESS page about GUI Compilers.
查看关于GUI 编译器的官方 LESS 页面。
回答by NickBeaugié
I had trouble compiling Bootstrap LESS (after installing the Twitter.Bootstrap.Less NuGet).
我在编译 Bootstrap LESS 时遇到了麻烦(在安装了 Twitter.Bootstrap.Less NuGet 之后)。
The trick with WebEssentials is to cause the bootstrap.less file to need saving (typing a space, then pressing delete is sufficient), then saving it. The corresponding .css, .min.css and css.map files are automatically generated and appear nested under the .less file in Solution Explorer.
WebEssentials 的技巧是使 bootstrap.less 文件需要保存(输入一个空格,然后按 delete 就足够了),然后保存它。相应的 .css、.min.css 和 css.map 文件会自动生成并嵌套在解决方案资源管理器中的 .less 文件下。
回答by Jorge Goncalves
Easy:
简单:
- Tools->Extensions and Updates-> Install Web Extension Pack(Mads Kristensen's)
- On Project, Add->New Item-> Less Style Sheet
- Edit the .less and save the file
- Right Click on the .less file-> Web Compiler-> Re-Compile File
- 工具-> 扩展和更新-> 安装 Web 扩展包(Mads Kristensen 的)
- 在项目中,添加->新建项目->较少样式表
- 编辑 .less 并保存文件
- 右键单击 .less 文件-> Web Compiler-> Re-Compile File
Afterwards the resulting .css file will be generated on every file save.
之后,将在每个文件保存时生成生成的 .css 文件。
回答by Chieleman
Another small tool to compile LESS after it has been saved is WinLess.
另一个在保存后编译 LESS 的小工具是 WinLess。
Not much options but small and simple. And it does the job!
选择不多,但又小又简单。它可以完成工作!
Don't know what the experience of other users is, but WebEssentials 2013 does not work well on my machine with Visual Studio 2013 (Ultimate) and the settings, well... No UI and can't turn features completely off which i don't want to use.
不知道其他用户的体验如何,但 WebEssentials 2013 在我的机器上运行的不好,我的机器上有 Visual Studio 2013(终极版)和设置,嗯......没有用户界面,不能完全关闭我不知道的功能不想用。
回答by Erdogan Kurtur
You can also use Chirpy which allows editing of many modern web technologies that MS missed.
您还可以使用 Chirpy,它允许编辑 MS 错过的许多现代 Web 技术。