Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.less compilation error when query string is supplied

I have an ASP.Net MVC application which compiles .less files into CSS. In a particular scenario if I hit my endpoint

http:///Account/ResetPassword?t=eyJ0eXAiOiJKV1Qi...

the query string results in a .less compilation warning

directive block with unrecognised format on line 1 in file '~/Content/packageForm.less': []: /beginning of file [1]: @t: eyJ0eXAiOiJKV1Qi...;
^ [2]: @import "setup.less"; directive block with unrecognised format on line 1 in file '~/Content/packageForm.less': []: /beginning of file [1]: @t: eyJ0eXAiOiJKV1Qi...;
^ [2]: @import "setup.less"; directive block with unrecognised format on line 1 in file '~/Content/IE.less': []: /beginning of file [1]: @t: eyJ0eXAiOiJKV1Qi...;
^ [2]: #notes{ directive block with unrecognised format on line 1 in file '~/Content/IE.less': []: /beginning of file [1]: @t: eyJ0eXAiOiJKV1Qi...;
^ [2]: #notes{

If I remove the query string parameter 't' then no compilation errors occur.

Does anyone have a solution?

Thanks,

Paul.

like image 926
Paul Houlston Avatar asked Dec 10 '14 10:12

Paul Houlston


2 Answers

The issue occurs due to a possible bug in dotless WebOptimization Adapter.

To workaround the issue, please add disableParameters="true" to dotless configuration section in your Web.config as shown below:

<dotless minifyCss="false" cache="true" web="true" disableParameters="true" />
like image 175
ogggre Avatar answered Nov 03 '22 02:11

ogggre


I just solved the problem by updating dotless and dotless adapterfor System.Web.Optimization to their last available versions:

  • dotless: new version 1.5.0
  • dotless adapterfor System.Web.Optimization: new version 1.3.3

For history on this problem, and the resolution, see the GitHub issue "Empty CSS generation at startup" and the related pull request that fixed it.

like image 21
amp Avatar answered Nov 03 '22 02:11

amp