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.
Open the Book Review WSP in Visual Studio, go to the Build menu, and select the Publish Web Site menu option. This launches the Publish Web Site dialog box (see Figure 1), where you can specify the target location, whether or not the precompiled site's user interface is updatable, and other compiler tool options.
When precompiling for deployment, the compilation tool creates a target location folder, compiles the specified web application's source code, and copies these compiled assemblies and the content files into the target location folder.
The default (checked) setting of "Allow precompiled site to be updateable" allows you to update your view content without needing to rebuild the entire project.
Performing Precompilation You can precompile a Web site using the Aspnet_compiler.exe tool on the command line. For more information, see How to: Precompile ASP.NET Web Sites for Deployment and ASP.NET Compilation Tool (Aspnet_compiler.exe). Visual Studio also includes commands to precompile a Web site from the IDE.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With