I wonder if there is a way to precompile *.less
files(http://www.dotlesscss.org/) with visual studio.
The site gives me a dotless.compiler.exe
but I am not sure how to hook this up to visual studio. I am looking for a solution for both Webforms and ASP.NET MVC.
Depending on your build environment, you can kick off dotless.Compiler.exe
as a build task.
For example, using a Pre-Build task in Visual Studio (all 1 line):
$(SolutionDir)Tools\dotLess\dotless.compiler.exe -m
$(ProjectDir)content\css\site.less $(ProjectDir)content\css\site.css
The macros ($(SolutionDir)
, etc) allow a bit of flexibility to project and file locations. Rather than using the standard .less
files, simply reference the new .css
files in your markup.