Search code examples
lessdotless

Using LESS only to generate CSS as part of builds, not generating per-request?


I just started looking into dotless for my VS2012 solution and it seems that the less is compiled down to css every time a request hits the less file. This seems like a waste of cycles - I'm not going to be changing my CSS that much, and if I do, I'll deploy again.

Is it possible to use LESS as a developer-only tool to generate css that the clients download directly? A compile-on-demand version that I would use only when I make changes?

I don't see the benefit of compiling per request... if anyone can shed some light on that as well, I'd appreciate it.


Solution

  • You can using bundling and minification in .NET 4.5 to bundle and minify your LESS files into CSS.

    Here is a quick guide on how to do it. Bundling and minification with dot-less