Install from NuGet
  • Download & install NuGet Package Manager extension for VS.NET 2010
  • Open your project in VS.NET 2010
  • Open the Package Manager Console (Tools > Library Package Manager > Package Manager Console)
  • In the command window:
    • If you work with ASP.NET MVC: enter Install-Package Combres.Mvc
    • If you work with ASP.NET WebForm: enter Install-Package Combres

Register Route
This step is only necessary for ASP.NET 3.5 users. ASP.NET 4.0 users can skip to the next step. This step is necessary because there's currently no way to generate/transform/reference different code/config/assemblies for different .NET runtimes with NuGet.
  • Delete the generated file AppStart_Combres.cs
  • Remove the reference to the assembly WebActivator
  • Open global.asax code-behind file
    • Import Combres namespace, i.e. using Combres;
    • Add this to the first line of either RegisterRoutes() or Application_Start(): RouteTable.Routes.AddCombresRoute("Combres");

Modify Combres.xml
  • Open App_Data/Combres.xml (this should be auto-created when you install the Combres NuGet package)
  • Add/remove resource sets, resources etc. as per your need. See this article for more information.

Reference to Combres' resource sets in view
  • Open any view page (e.g. master page) which need to reference JS/CSS resource sets defined in Combres.xml
  • Add the followings:
<%= WebExtensions.CombresLink("siteCss") %>  
<%= WebExtensions.CombresLink("siteJs") %>

Notes:
  • Change the values of the arguments to match the names you use in Combres.xml
  • If you use ASP.NET MVC, you can replace WebExtensions with Html or Url (you need to import Combres.Mvc namespace instead of Combres namespace)
  • If you use Razor view engine, you need to add @using Combres or @using Combres.Mvc explicitly (if you want to configure in web.config, read this post)

Optional: Using Local-Closure minifier
Combres goes with several excellent minifiers like YUI and MS Ajax, so people probably don't have much reason to use the local-closure minifier, which usually has poorer performance because Combres needs to invoke it out of process. That said, if you want to use local-closure minifier, simply download compiler.jar and copy it to the bin folder of your application

That should be it. Start your browser and view source to observe Combres in action.

Last edited Jan 27, 2011 at 4:36 AM by buunguyen, version 7

Comments

darkking86 Nov 28, 2012 at 5:41 AM 
This is what I really need and looking for many times.
Good job ;)

delpak Jun 16, 2012 at 2:49 PM 
All in One Solution! It s Great!