gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 22:08:30 24 4
gpt4 key购买 nike


我的任务是开始使用 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”)。

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

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com