如何在VS 2013中编译Bootstrap LESS源 [英] How to compile Bootstrap LESS source in VS 2013

查看:121
本文介绍了如何在VS 2013中编译Bootstrap LESS源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装并更新了Visual Studio 2013 Ultimate Update 4以及Web Essentials.
我下载了Bootstrap V3.3.1源码,并将css,js,字体和less文件夹复制到了Visual Studio.

I have visual studio 2013 Ultimate Update 4 plus Web Essentials installed and updated.
I download bootstrap V3.3.1 source I copied the css, js, fonts and less folder to visual studio.

现在,我要编辑所有.less文件以覆盖bootstrap.css文件,然后在解决方案资源管理器中选择所有文件,然后单击鼠标右键,但禁用所有Web Essentials菜单项.

Now I want to compile all .less files after my edits there to overwrite the bootstrap.css file, I selected all files in solution explorer and right click but all Web Essentials menu items disabled.

将所有文件编译为.css文件应遵循的步骤是什么?或者我应该使用与Web Essentials不同的工具?

What are the steps I should follow to compile all files to .css file or should I use a different tool than Web Essentials?

推荐答案

为便于记录,当前的Web Essentials会在进行编辑时重新编译所有已编译的文件,包括非CSS生成的文件,例如variables.less.您只需要在第一次时手动对其进行编辑,即可将其置于此模式.例如,要重新命名Bootstrap变量的新项目的过程为:

For the record the current Web Essentials will re-compile any compiled files when edits occur, including non CSS generating files like variables.less. You just need to manually edit them the first time to put them into this mode. For example the procedure for new projects which want to re-brand Bootstrap variables is:

  1. 确保已安装当前的Web Essentials Visual Studio软件包.
  2. 将Bootstrap Source NuGet软件包添加到站点.
  3. 手动编辑要自动正常正常生成的文件,例如/Content/bootstrap/bootstrap.less和theme.less.保存第一次编译时,将在解决方案资源管理器中生成.css和min.css作为相关项目.
  4. 现在,当您编辑相关文件(例如,无需做商标的变量)时,编译后的引导程序和主题CSS会在构建过程中自动更新.

唯一与此有关的部分是您必须第一次编辑原始源,更改时间戳.希望以后不会对NuGet软件包的更新造成问题.

The only dirty part about this is the first time you have to edit the original source, changing the timestamp. Hopefully that does not cause problems with updates to the NuGet package in the future.

Web Essentials项目中有一个与此相关的未解决问题.一个简单的解决方案是让上下文菜单选项第一次手动执行,另一个解决方案是在Visual Studio中对文件进行永久设置,例如构建操作或自定义工具操作.

There is an open issue in the Web Essentials project about this. One simple solution is to get the context menu option to do it manually the first time, the other is a permanent setting on the file in Visual Studio, such as the build action or custom tool action.

https://github.com/madskristensen/WebEssentials2013/issues/1632

您可以在Visual Studio的工具-选项-Web Essentials-较少"设置中更改重新编译的行为.

You can change the behaviour of recompilation in the Visual Studio "Tools - Options - Web Essentials - LESS" settings.

这篇关于如何在VS 2013中编译Bootstrap LESS源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆