ASP.NET MVC - 脚本结合 [英] ASP.NET MVC - Script Combine

查看:75
本文介绍了ASP.NET MVC - 脚本结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.NET小组在3.5 SP1发布的脚本功能结合起来这里<详细href=\"http://www.asp.net/Learn/3.5-SP1/video-296.aspx\">http://www.asp.net/Learn/3.5-SP1/video-296.aspx.是否有类似的功能已为MVC框架?如果不是,这是在范围上还是可能以某种方式利用MVC中的WebForms能力?我看到这个网站使用了自定义jquery.package.master当中,我认为,他们已经推出自己(也许到构建周期,但它是不是因此所有的精缩,我认为他们已经手动附加脚本在一起,而不是一些自动缩小和放;结合任务)。有兴趣的任何想法如何做到这一点的MVC,但我不想开始滚动任我自己的功能的情况下,我会在进步中得到重复工作。

The ASP.NET team released the script combining feature in 3.5 SP1 as detailed here http://www.asp.net/Learn/3.5-SP1/video-296.aspx. Is there a similar feature already for the MVC framework? If not, is this in scope or is it possible to somehow leverage the webforms capability in MVC? I see this site uses a custom jquery.package.master which, I assume, they have rolled themselves (maybe into the build cycle, however it is not all minified therefore I think they have manually appended the scripts together rather than some automated minify & combine task). Would be interested in any ideas how to accomplish this in MVC but I dont want to begin rolling any of my own functionality in case I will be duplicating work in progress.

推荐答案

下面是我做的,如果它是有帮助的。

Here's what I do, in case it's helpful.

在我postbuild我叫命令行版本 = http://dean.edwards.name相对=nofollow>院长爱德华兹派克。它结合了脚本,并把它们打包给我。

In my postbuild I call a command line version of Dean Edwards's Packer. It combines the scripts and packs them for me.

不过现在,我把我所有的东西,单独并使用一个辅助方法,包括我的脚本,如果调试标志不是present它将包括包装的版本,否则它包括解压。

For now though, I keep all of my stuff seperate and use a Helper method to include my scripts, and if the debug flag is not present it will include the packed versions, otherwise it includes the unpacked.

这篇关于ASP.NET MVC - 脚本结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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