This project is read-only.


Combine script is general function for optimize speed of loading web page by reducing amount of file to be downloaded from web server. Currently, it supports both JavaScript and Css files. For Css file, all url-based value will be replaced with correct value if combined Css is not the same directory with original file.

If there are some changed files in script files, combined script will be regenerated. But I use add or remove some script file to combine script method you must remove combined file from your application.


1. Add reference to Microsoft AJAX Minifier 4.0


You can get latest version of Microsoft Ajax Minifier by clicking the following link. But If version of AjaxMin or any other 3rd party assemblies is changed, you must re-complies for generating Higgs assembly for the new version changed assembly.

2. Create View for testing

@using Higgs.Web.Helpers
    Layout = null;

<!DOCTYPE html>

    <title>Basic - Combine Script</title>
    <script type="text/javascript">
        $(function () {
            $('body').append('Hello World! from jQuery.');

3. Set debug = false in web.config file


4. View Result

As you see, all script files are combined into only one file that name common.js that located in Scripts directory.



If you change debug to true, you will see something like this.


Moreover, you can use static compression feature in IIS 7 by adding the following setting to your web.config file.

    <httpCompression staticCompressionDisableCpuUsage="true">
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />

Download: Basic - Combine Script.7z

PS. you can see how to create project and add reference at Basic – Hello World.

Last edited Jan 21, 2011 at 9:53 AM by SoulMaster, version 4


No comments yet.