Asp.Net捆绑不使用.min文件 [英] Asp.Net bundling not using the .min files

查看:112
本文介绍了Asp.Net捆绑不使用.min文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据以发布模式,如果它存在打捆应该使用.min.js文件文档。我加入角方式如下:

According to documentation in release mode the bundler should use the .min.js file if it exists. I am adding angular the following way:

bundles.Add(new ScriptBundle(Bundles.Scripts).Include(
                        "~/Content/Scripts/angular.js"));

我在同一个文件夹angular.js和angular.min.js。所以,按我的理解应该打捆只使用angular.min.js并没有做任何事情本身。但是,当我检查结果在HTTP响应,这是不同的。它也缩小的,但所有的名字是不同的:

I have angular.js and angular.min.js in the same folder. So according to what I understand the bundler should just use the angular.min.js and do not do anything itself. But when I check the result in the http response, it's different. It's also minified, but all the names are different:

我得到在浏览器是什么:

What I get in the browser:

(function(n,t,i){"use strict";function v(n)

Angular.min.js

Angular.min.js

(function(P,X,u){'use strict';function M(b)

有人可以解释为什么发生这种情况?是否打捆只是忽略.min文件或将其minifies再次.min.js?

Can someone explain why this is happening? Does the bundler just ignore the .min file or it minifies again .min.js?

P.S。我试图删除angular.js文件,我之后得到一个空的结果,所以它似乎打捆并不关心在所有angular.min.js存在。

P.S. I have tried to delete the angular.js file and I get an empty result after that, so it seems the bundler does not care at all that angular.min.js exist.

推荐答案

看来,在一个ScriptBundle的情况下,图书馆没有做自己应该并试图来缩小的任何文件。我把它改成只包这似乎使的伎俩,并加载preminified版本。

It seems that in case of a ScriptBundle the library does not do what it should and tries to minify any file. I changed it to just Bundle and that seems to make the trick and load the preminified versions.

在这里找到了答案:风格捆绑为MVC4不使用分档

这篇关于Asp.Net捆绑不使用.min文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆