c# - Dotless fails silently when parsing Bootstrap 2.3.1 to CSS -
here's lesstransform class use parse .less
files .css
files:
public class lesstransform : ibundletransform { public void process(bundlecontext context, bundleresponse response) { response.content = dotless.core.less.parse(response.content); response.contenttype = "text/css"; } }
i'm trying parse downloaded bootstrap.css
file using lesstransform
class. when method running, response.content
has contents of bootstrap.
after call dotless.core.less.parse()
, response.content
blank. parser failing silently.
why?
your less parsing doesn't have error handling, errors being silently ignored. if handling errors, you'd see following:
expected '}' on line 577 in file '../bootstrap/mixins.less': [576]: [577]: .spanx (@index) when (@index > 0) { --------------------^ [578]: .span@{index} { .span(@index); }
it looks bootstrap uses less syntax dotless not yet support. try older bootstrap version (i've used bootstrap 2.0 dotless before).
to implement error handling, need add ilogger
implementation. this:
var config = new dotlessconfiguration { loglevel = loglevel.error, // put custom logger implementation here logger = typeof(lesscsslogger) }; var lessengine = new enginefactory(config).getengine(); var outputcss = lessengine.transformtocss(response.content, null); response.content = outputcss;
where lesscsslogger
implements ilogger
. dotless comes aspresponselogger
might able use.
Comments
Post a Comment