NEWS -- 16-May-2017 Due to pending Codeplex shutdown, code has been moved to

Project Description

JavascriptHelper is a MVC component which allows you to specify that a Javascript file is needed, wherever you need it (view, partial views, layouts, helpers etc.) and the helper will collection them all up, plus all their dependencies – in the right order-- and insert all the <script> tags in one spot --- and at the same time, do the same thing for the CSS files those JS scripts need.


My goals for the JavascriptHelper were the following:
  • To have all needed JS files grouped together, in a single spot I specify (presumably at the bottom of the layout)
  • To be able to specify in a view, partial view, or helper that a JS file is needed.
  • To have all JS files that file depends on included automatically
  • To have files included only once, regardless of how many pieces requested them.
  • To be able to associate a needed CSS file, and have it similarly included where I specify in the layout.
  • To be able to specific a needed file by a simple name.
  • To be able to easily update the file a particular name refers to (So, if I replace, say MetaFlex-1.5.3.js with MetaFlex-1.6.0.js I only need to change it in one spot, and every page that uses it changes)
  • To be able to use one version of a file during development/debugging and easily switch to another (presumably mini-ified) for production.
  • To be able to use a local version of a file during development/debugging (when I’m often off-line), and easily switch to Google’s CDS for production.
  • To be able to gather a collection a JS files into a single, combined, mini-fied file using the MVC4 bundling/compression APIs.
  • To be able to specify a block of JS code in a view, partial view or helper and have all the code blocks grouped together.
  • To be able to say if a code block should be included once per page, or repeatedly.

Next Steps
Source Code

Last edited May 16 at 9:18 PM by JamesCurran, version 4