gpt4 book ai didi

bundle - mvc 4 bundle 只是 jquery 1.7 结果在 "unexpected token ' ('"

转载 作者:行者123 更新时间:2023-12-04 05:53:32 24 4
gpt4 key购买 nike

_Layout.cshtml :

<script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/desktop-js-bundle")" type="text/javascript"></script>

Global.asax.cs :
var desktopJsBundle = new Bundle("~/desktop-js-bundle", new CssMinify());
desktopJsBundle.AddFile("~/scripts/jquery-1.7.1.min.js");
BundleTable.Bundles.Add(desktopJsBundle);

当我在 http://localhost:52221/desktop-js-bundle?v=... 上查看源代码时,我看到以下内容:
/* Minification failed. Returning unminified contents.
(2,1): run-time error CSS1019: Unexpected token, found '('
(and some other errors like this)
*/
/*! jQuery v.1.7.1 jquery.com | jquery.org/license */
(function(a,b)(function cy(a)....... (the rest of the jquery library. NOTE: starts with that "(")

我错过了什么? mvc 4 中提供的 bundle 真的不像 jquery 以“(”开头的方式吗?谢谢。

更新!
我正在使用 new CssMinify()而不是 new JsMinify() .

最佳答案

我猜它不会喜欢 .min jquery 缺少的分号。尝试传入未缩小的 jquery。另一方面,我不会有一个包含 jquery 的打包器/压缩器。您通常会通过直接访问 google 或 MS CDN 获得更好的性能,因为这些可能会预先缓存在您的查看器浏览器中。

关于bundle - mvc 4 bundle 只是 jquery 1.7 结果在 "unexpected token ' ('",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9788801/

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