Visual studio - precompile - dotless

后端 未结 7 1597
萌比男神i
萌比男神i 2020-12-13 04:48

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

7条回答
  •  一整个雨季
    2020-12-13 05:27

    Here's the solution I came up with, using MSBuild. It's incremental, so it should only happen when the Less changes. It also correctly handles @import.

    First, add dotless to your project with NuGet. You don't need any of the magic it adds to your web.config, so you can revert that - you're just using it to get the compiler executable.

    Next, add your "root" Less files to your .csproj, like so:

    
        
    
    

    Finally, add this snippet at the bottom of your .csproj:

    
        
        
    
    
        
    
    

提交回复
热议问题