2

Is there a way to call dotless API programmatically and get final CSS?

Something like this:

string lessCSS = File.ReadAllText(lessCSSfile);
string finalCSS = dotless.Core.Less.Parse(lessCSS);
madth3
  • 7,275
  • 12
  • 50
  • 74
Sha Le
  • 1,261
  • 2
  • 11
  • 10
  • Sounds like this is a duplicate of http://stackoverflow.com/questions/4798154/how-can-i-output-errors-when-using-less-programmatically – Sha Le Mar 28 '11 at 18:30
  • 1
    The code you posted works fine so there is actually no point to this question.. – Tigraine Apr 05 '11 at 11:48
  • @Tigraine, as mentioned below...the code silently throws an exception. – Sha Le Apr 08 '11 at 17:42

1 Answers1

0

My CSS had a hack for IE5 and that triggered a parser exception, that's why it was not working.

Here is my test code:

try
{
   Ruleset ruleset = new dotless.Core.Parser.Parser().Parse(source, fileName);
   rv = ruleset.ToCSS();
}
catch (ParserException pe)
{
   Response.Write(pe.Message);
}
Sha Le
  • 1,261
  • 2
  • 11
  • 10