提供查询字符串时的.less编译错误

时间:2021-09-01 13:16:35

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

我有一个ASP.Net MVC应用程序,它将.less文件编译成CSS。在特定情况下,如果我点击我的端点

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

HTTP:///帐户/ ResetPassword T = eyJ0eXAiOiJKV1Qi ...

the query string results in a .less compilation warning

查询字符串导致.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/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.

如果我删除查询字符串参数't',则不会发生编译错误。

Does anyone have a solution?

有没有人有办法解决吗?

Thanks,

谢谢,

Paul.

保罗。

2 个解决方案

#1


5  

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

由于无网络WebOptimization适配器中可能存在错误,因此会出现此问题。

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

要解决此问题,请在Web.config中的无点配置部分添加disableParameters =“true”,如下所示:

<dotless minifyCss="false" cache="true" web="true" disableParameters="true" />

#2


4  

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

我刚刚通过将System.Web.Optimization的无点和无点适配器更新到它们的最新可用版本来解决了这个问题:

  • dotless: new version 1.5.0
  • 无点:新版本1.5.0
  • dotless adapterfor System.Web.Optimization: new version 1.3.3
  • System.Web.Optimization的无点适配器:新版本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.

有关此问题的历史和解决方案,请参阅GitHub问题“启动时清空CSS生成”以及修复它的相关拉取请求。

#1


5  

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

由于无网络WebOptimization适配器中可能存在错误,因此会出现此问题。

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

要解决此问题,请在Web.config中的无点配置部分添加disableParameters =“true”,如下所示:

<dotless minifyCss="false" cache="true" web="true" disableParameters="true" />

#2


4  

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

我刚刚通过将System.Web.Optimization的无点和无点适配器更新到它们的最新可用版本来解决了这个问题:

  • dotless: new version 1.5.0
  • 无点:新版本1.5.0
  • dotless adapterfor System.Web.Optimization: new version 1.3.3
  • System.Web.Optimization的无点适配器:新版本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.

有关此问题的历史和解决方案,请参阅GitHub问题“启动时清空CSS生成”以及修复它的相关拉取请求。