Reputation: 4158
I know how you can use dotless to have LESS file(s) compiled into CSS when bundling in an MVC app. What I want to be able do, though, is control the LESS-to-CSS conversion in a C#/.NET application outside of the scope of bundling. Is there a way to either define a destination location in the file system or retrieve a stream of the CSS file in code using Cassette.less?
Upvotes: 3
Views: 8642
Reputation: 15609
The simplest way is to use Web Essentials to compile LESS
into CSS
for you. You can then use the generated file for bundling.
If you wanted even more control over the process you could always create a grunt/gulp task to compile the LESS
.
Upvotes: 1
Reputation: 49044
You can reference the dotless.Core.dll in your C# console app and than call Less.Parse();
. The Less.Parse();
only accepts code. If you will have to compile a file (with imports) you can use the dotless.Compiler command as suggested by @im1dermike.
See also: http://tedgustaf.com/blog/2010/11/setup-dotless-in-aspnet-project/
Upvotes: 2