简体   繁体   English

如何设置Visual Studio编译LESS文件的目录?

[英]How to set directory where Visual Studio compiles LESS files?

I am using VS 2012 on Win 7. Currently (by default, I assume) it compiles LESS files to CSS on save to the same directory as the LESS file. 我在Win 7上使用VS 2012。目前(默认情况下,我假设)它将LESS文件编译为CSS,保存到与LESS文件相同的目录。

I would rather save all my CSS files to a "css" directory next to the "less" directory. 我宁愿将所有CSS文件保存到“less”目录旁边的“css”目录中。 I'm coming from the Mac using CodeKit to compile, and here you can choose an output path. 我是从Mac使用CodeKit进行编译的,在这里你可以选择一个输出路径。 I can't figure out how to set the output path in VS. 我无法弄清楚如何在VS中设置输出路径。

What I am looking for is: 我在寻找的是:

-Projectroot
----less
----css
----js
etc.

Where my LESS files are all in "/less" and the compiled css goes to "/css" 我的LESS文件全部为“/ less”,编译的css为“/ css”

If you're working in a team you'll probably want them to have the same CSS output folder as yours (and not telling each one of them to change their default Web Essentials settings) so the best way is to output your setting per Visual Studio Solution. 如果你在一个团队中工作,你可能希望他们拥有与你相同的CSS输出文件夹(而不是告诉他们每个人更改他们的默认Web Essentials设置),所以最好的方法是每个Visual输出你的设置Studio解决方案。

  1. In Visual Studio menu go to WEB ESSENTIALS > Create solution settings : 在Visual Studio菜单中,转到WEB ESSENTIALS>创建解决方案设置

    在此输入图像描述

  2. A new folder and file will be created under your solution: 将在您的解决方案下创建一个新的文件夹和文件:

    在此输入图像描述

    Open the generated file WebEssentials-Settings.json and change the property OutputDirectory under Less to your desired folder path: 打开生成的文件WebEssentials-Settings.json和改变更低温度下的性能输出目录到你想要的文件夹路径:

    在此输入图像描述

Hope that helps. 希望有所帮助。

您是否尝试过TOOLS> OPTIONS> WEB ESSENTIALS> LESS并设置自定义输出目录?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM