开发者

How to handle Dependency Management with javascript files using MVC?

开发者 https://www.devze.com 2023-02-02 11:44 出处:网络
I would like to know a good approach to develop a growing web application which consist in a large set of javascript files, depending on the screen.

I would like to know a good approach to develop a growing web application which consist in a large set of javascript files, depending on the screen.

I've searched without success...

In this site, i have some solutions: http://addyosmani.com/blog/large-scale-jquery/

I got the RequireJs as a good start point.

But... to the point... I'd like a feature where can be found in the php framework called Yii.

Its way to handle a bunch JS files is very simple. I tell to the framework, which file i need in a specific View, or Partial. The framework renders to me without duplicatin any include script tag.

Is there any feature like that in ASP.MVC framework? Or any开发者_运维问答thing like that? I think i could do this making a Helper, don't know if it is a good way to handle thousands and thousands screen with plus thousand javascripts.


Telerik use a HtmlHelper extension to do this:

    <%:Html.Telerik().ScriptRegistrar().DefaultGroup(
         grp => grp.Add("telerik.common.min.js").Add("telerik.draganddrop.min.js")
                    .Add("telerik.window.min.js")).jQuery(false).Globalization(true)%> 

<%

but obvioulsy you're not going to get intellisence if you do this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号