c# - WebGrease 捆绑忽略全局变量

标签 c# manifest webgrease


我的任务是开始使用 ASP.NET Bundling 而不是 RequestReduce。 起初这似乎是一项简单的任务,但后来我遇到了问题,当 minifieng CSS 文件时:

(3017,287): run-time error CSS1054: JavaScript error in expression property: Variable 'jGrowl' has not been declared: jGrowl 
(3017,287): run-time error CSS1054: JavaScript error in expression property: Variable 'ignoreMe2' has not been declared: ignoreMe2 
(3018,151): run-time error CSS1054: JavaScript error in expression property: Variable 'ignoreMe' has not been declared: ignoreMe
(3022,156): run-time error CSS1054: JavaScript error in expression property: Variable 'ignoreMe2' has not been declared: ignoreMe2 

我发现是 jGrowl 搞砸了我。 经过一番谷歌搜索后我发现:http://kenhaines.net/post/2012/06/09/WebGrease-As-seen-in-Visual-Studio-2012.aspx

在那里我发现:

Your file appears to have undeclared JS globals in it, so the errors are expected. You should add them to the GlobalsToIgnore setting in the webgrease manifest file.

ex:

<GlobalsToIgnore>jGrowl;ignoreMe;ignoreMe2</GlobalsToIgnore>

webgrease list 文件在哪里?我该如何编辑它?

我用谷歌搜索了很多次,但没有任何运气

顺便说一句。我的第一个问题在这里,所以对我的问题设置的反馈也很好:)

//和平结束

最佳答案

WebGrease 支持两种模式:运行时和构建时。

运行时模式由 ASP.NET 在捆绑和缩小过程中使用。在此模式下,WebGrease DLL 在网站运行时被调用。

当从命令行或构建过程调用 WG.EXE 时,将使用构建时模式(或命令行模式)。

WebGrease list 功能仅适用于构建时或从命令行运行 WG.EXE。这些 list 文件为用户提供了为 WebGrease 添加附加配置参数(例如“GlobalsToIgnore”)的方法。

不幸的是,工作组 list 不可用于运行时。因此,如果您从 ASP.NET 进行缩小,您将无法使用它们。

关于c# - WebGrease 捆绑忽略全局变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22250716/

相关文章:

css - 带有 Safari 的 HTML5 appcache 导致跨站点 css 无法加载

java - 简单的 Swing 应用程序。 jar 文件在我的电脑上运行,但在其他电脑上不运行

asp.net-mvc-4 - 从nuget升级到webgrease 1.5.1.25624后,出现System.IO.FileLoadException

c# - DynamoDB 数据模型中的 map 列表

c# - 在字段更改时显示 asp-validation-summary

c# - 您如何随机将整数中的一位归零?

c# - 使用 Paypal REST C#

c - 如果 Windows UAC 被拒绝,有没有办法让代码以较低的权限运行