纸盒包VS MVC4包 [英] Cassette bundles vs MVC4 bundles

查看:116
本文介绍了纸盒包VS MVC4包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作的一个原型ASP.NET MVC 3解决方案,将被用作几个项目基地重写(从网页表格)。

I am currently working on a prototype ASP.NET MVC 3 solution that will be used as a base for several project rewrites (from web forms).

一个,我有一个目标是实现跨应用程序的一些脚本管理,而不是没有,我们目前拥有。

One of the goals that I have is to implement some script management across application as opposed to none that we currently have.

MVC 3 的有一个缺陷恕我直言:如果你需要的局部视图或模板视图中指定特定的脚本 - 你可能最终要么失去控制,其中脚本块位于呈现的HTML或有指定父视图的每一个相关的JavaScript文件。

MVC 3 has a flaw IMHO: if you need specific script specified on a partial view or template view - you might end up either losing control over where script block is located in rendered HTML or having to specify every single dependent javascript file on the parent View.

我一直在认真考虑使用 http://getcassette.net/ 作为一个框架来解决问题描述。然而,MVC4测试的最后一个版本让我再次怀疑自己:MVC的捆绑看起来非常相似,纸盒的包和我感到困惑又说:

I have been seriously considering using http://getcassette.net/ as a framework to resolve described issue. However, last release of MVC4 beta made me doubt myself again: MVC's Bundles look really similar to Cassette's Bundles and I am confused again:


  1. 我现在应该实现磁带,比迁移到MVC4包?

  1. Should I implement cassette now and than migrate to MVC4 bundles?

我应该实施一些简单的脚本经理自己(某事象脚本中MVC4 preVIEW辅助类),然后迁移到MVC4

Should I implement some simplified script manager myself (sth. like Scripts helper class in MVC4 preview) and then migrate to MVC4

或者我应该盒式融入项目,并希望它会更面向未来比MVC的imlementation(我真的不喜欢这个选项,现在只是因为依赖盒自带的数量之多)。

Or should I integrate cassette into project and hope that it will be more future-proof than MVC's imlementation (I really don't like this option right now just because of sheer number of dependencies cassette comes with).

我有磁带本身没有经验,发现它真的很难作出比较自己和AP将preciate任何答案或提示。

I have no experience with Cassette itself and find it really hard to make the comparison myself and would appreciate any answers or hints.

编辑:
我只是有另一种选择:在安装测试版的NuGet包MVC捆绑:<一href=\"https://nuget.org/packages/Microsoft.Web.Optimization\">https://nuget.org/packages/Microsoft.Web.Optimization

结论:
我看着M​​VC4束实现​​更多更大的不同,我注意到:上述MVC3问题MVC4束没有解决 - 他们就是捆绑和放大器;缩小。此外,磁带不只是能够在一个特定的地方它也能够以正确的顺序是不平凡的,命令他们渲染的脚本标签。
因此,在这一刻,我并不满足于任何解决方案,我会尽量拿出我自己的最小实现希望情况会在未来改善。

CONCLUSION: The more I look into MVC4 bundle implementation the bigger difference I notice: MVC4 bundles do not address MVC3 issue described above - they just do bundling & minification. Moreover, cassette is not just capable of rendering script tags in a specific place it is also capable of ordering them in correct order which is not trivial. So at the moment I am not satisfied with either of solutions and I will try to come up with my own minimalistic implementation hoping that situation will improve in the future.

但是,如果你不怕加入 5 + 依赖和一堆的web.config变化到您的项目 - 去卡带。我希望它会在某个时刻利用MVC里面捆绑,以减少重复的功能,并希望,将会变得更加模块化的更新。

But if you are not afraid of adding 5+ dependencies and bunch of web.config changes into your project - go for cassette. I hope it will be updated at some point to utilize MVC bundling inside to reduce functionality duplication, and hopefully, will become more modular.

更新:
由于磁带的2.0版本,它不再是必要的,包括咖啡剧本和磁带的其他功能,如果你只需要捆绑和JS的依赖分辨率。所以在这一点上盒是一个明显的赢家给我。

UPDATE: As of version 2.0 of Cassette it is no longer necessary to include coffee script and other features of Cassette if you just need bundles and js dependency resolution. So at this point Cassette is a clear winner to me.

推荐答案

有关ASP.NET MVC捆绑信息是在这里:<一href=\"http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx\">http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx.

Information about ASP.NET MVC bundling is here: http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx.

ASP.NET是增加一个功能,该功能可以很容易地捆绑或
  合并多个CSS和JavaScript文件到较少的HTTP请求。
  这将导致浏览器请求少了很多文件,并依次
  缩短了获取它们的时间。

ASP.NET is adding a feature that makes it easy to "bundle" or "combine" multiple CSS and JavaScript files into fewer HTTP requests. This causes the browser to request a lot fewer files and in turn reduces the time it takes to fetch them.

ASP.NET的下一个版本还增加了新的功能,使得它
  容易降低或运行如下的内容的下载大小以及

The next release of ASP.NET is also adding a new feature that makes it easy to reduce or "minify" the download size of the content as well.

看起来它本质上是一回事盒。所有其他的事情都是平等的,使用的解决方案,是原产于ASP.NET MVC。

Looks like it's essentially the same thing as Cassette. All other things being equal, use the solution that is native to ASP.NET MVC.

这篇关于纸盒包VS MVC4包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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