How can I output errors when using .less programmatically?

后端 未结 6 1149
广开言路
广开言路 2020-12-16 17:16

I\'ve written an ASP.NET MVC action method that receives a .less file name, processes it via Less.Parse() and outputs the processed css file.

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-16 17:27

    You can do this very easily with web.config. In your dotless configuration section, add the following: logger="dotless.Core.Loggers.AspResponseLogger". This will make dotless output the errors instead of blank css.

    I've included the following as an example. ("..." represents existing stuff in your web.config). In my example below cache is set to false. This is useful for debugging purposes. It should probably be set to true under normal circumstances.

        
         
               ...
              
    ...

提交回复
热议问题