You can combine and minimize inline javascript. Using the Razor template helpers, you can create an extension method similar to the one below:
public static MvcHtmlString AddScriptSource(this HtmlHelper helper, Func<dynamic, HelperResult> source, string key) { string scriptSource = source(null).ToHtmlString();
What you will use as follows:
@Html.AddScriptSource(@<text>$(document).ready(function() { $('h1').text('The current controller is @ViewContext.RouteData.Values["controller"].ToString()'); });</text>, "test")
I created a bunch and minifier around this a few weeks ago at:
https://github.com/philpeace/CodePeace.StrawberryJam
Phil peace
source share