Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.less css files in .NET and Visual Studio

  1. Is the recommended way of handling .less files to use pre-compiled static files or use some sort runtime conversion using for example a HttpHandler? What are the pros and cons of the different ways of doing it?
  2. What's the recommended techniques of solving the above suggested approach? Tools, libraries etc?
like image 245
Riri Avatar asked Sep 21 '11 19:09

Riri


1 Answers

Because you are on .NET, I recommend you check out the DotLess project. It's open source and very active. They have an HTTP Handler that plugs into IIS, it grabs any request for a .less file and returns a valid CSS file. I don't know what amount of caching they use, but you can probably rely on the browser to cache a good amount of it..

The DotLess project also has an executable that will compile when you want (like during a project build), or on demand prgrammatically.

The pros and cons for which way you do it really depends on your project. I think the best workflow may be to use LESS.js for development because you don't need external dependencies besides the javascript file, and all the changes are live right away. Then as the project is promoted through various testing and production environments, you can install the web server filter or precompile it. Again, it depends on how you want to solve it for your project.

like image 61
Nathan Strutz Avatar answered Sep 24 '22 22:09

Nathan Strutz