views:

104

answers:

1

I'm going to implement the load on demand technics for JavaScript code in ASP.NET MVC. Could you advice me the existing solutions and schemes for the platform?

I've found the post about this subject in KAZI MANZUR RASHID'S blog

What are the best practices for this task?

A: 

We are using this manager and pretty happy with it.

  1. Script combination (or concatenation). Scripts declared with MvcScriptManager will be combined on the fly into a single script file request when the page is rendered.
  2. Script minification (or crunching) in release mode. Minification process is done only once at the first request that references the specific script. Subsequent requests will use the crunched script content in cache (see #5 for detail). Crunching can be enabled/disabled for each script.
  3. Render localized resources for stand-alone script files. Localized strings will be appended to the script if specified.
  4. Support configurable HTTP compression and expiration setting when outputing scripts.
  5. Script caching with file dependency. Script file content is cached so that rendering combined script file will be much more performant. Cache dependency is linked to the physical file therefore any script update in the file system will be reflected in the cache instantly.
  6. Support rendering scripts in debug/release mode based on the running environment.
  7. Resolving different paths for stand-alone script files.
  8. Support multiple MvcScriptManagers on a single page (or master page). Support both Master and Slave rendering mode so that scripts declared with one ScriptManager can be rolled over to another one for rendering.
  9. Suport web farm scenario.
Sergey Mirvoda
Thank you for the interesting link. I'm making the soulutions comparison right now.
fde
you are welcome )) Castle Project MonoRail also uses same approach http://hammett.castleproject.org/?p=310
Sergey Mirvoda