Scriptmanager Asp.Net Mvc

I'd like to have some of the scriptmanager features in the new Asp.net MVC model

1- Script combining 2- Resolving different paths for external javascipt files 3- Minify and Gzip Compression

Here is what I found but not sure is the best way for mvc approach. In general what is the your approach to deal with javascript code in the MVC model?

Answers


Maybe you could just create a new 'Scripts' controller with different actions serving different combinations of compressed JS files. Since MVC is designed with a resource oriented approach, i.e. URLs are now at the center of your programming model, why not define simple URIs for your Javascripts too ?

In your views, for example you could reference your files like this :

<script src="http://your_domain/scripts/all"/>

This would call your 'all' action, resulting in all your compressed script files being sent.

Of course you would need to code the combining and compressing for now, or maybe reuse the Scriptmanager internally, I don't know if it's possible.

This is just an idea though, currently I'm referencing individual javascript files directly in my master pages.


Need Your Help

How to change the name of the app on the iPhone?

iphone xcode icons rename

I did this before, but can't remember it now.

Binding a web page's element to an Android App

javascript android html css web

There is a website which has a login screen, and when the submit is hit, it goes to a new page and logs in the user.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.