Installing Assman for ASP.NET Mvc 2

1. Install the Assman.Mvc2 NuGet package:
Install-Package Assman.Mvc2
2. While Assman ships with a light javascript minifier (JSMin), it does not ship with a css minifier. If you want to enable css minification as well as better js minification, then install the Assman.YuiCompressor NuGet package
Install-Package Assman.YuiCompressor
3. If you are running .NET 3.5, add the following line of code to your routing setup (e.g. in your Global.aspx.cs file):
Note that the IgnoreWebResourceRoutes extension method requires you to add a "using Assman.Mvc" at the top of the file.
4. Open your site's layout/master page, and add the following inside the <head> element of your page:
5. Also add the following line right before the closing </body> tag
6. To include a stylesheet on your page, you can place this anywhere in a view or partial view:
To include a script at the bottom of your page (preferred):
If you would like an individual script to be included in the head of your page, you can call RequireScript and specify "head" like this:
@Html.RequireScript("~/path/to/my/script.js", "head")
For more info/recomendations on best practices/locations for including scripts, click here

Last edited Jul 4, 2011 at 7:32 PM by andyalm, version 1


No comments yet.