Squish.NET - 4 Simple Steps to Get Started

1. Create a "Class Library" project to hold your resources to be squished

Add Squish Resources Project

2. Add a reference to the Squish.NET DLL

Download a free trial , or purchase Squish.NET for $39.99.

Add Squish.NET Reference

3. Create a map class in this DLL

This assembly will serve as the container for all of your JavaScript and CSS resources. Each resource needs be marked as an 'embedded resource' and this assembly will contain one class: a mapping class to tell Squish.NET about each of your resources. See information towards the bottom of this page about the details of setting up this class.

By convention you should name your class "SquishMap".

Create Squish.NET Map

4. Modify your web.config for applications using Squish.NET

4a. Let ASP.NET know about the Squish.NET configuration section

<!-- Register the Squish.NET configuration section -->
<configSections>
    <sectionGroup name="system.web">
        <section name="squish" type="SquishNet.UI.SquishSectionHandler, SquishNet, Version=1.0.0, Culture=neutral, PublicKeyToken=b37abc0311ba52e8"/>
    </sectionGroup>
</configSections>

4b. Specify any Squish.NET customizations (hook up your map class from step 3)

In this example, the name of the assembly is "SampleData" and the full namespace of the map class we created is "SampleData.SquishMap".

See advanced usage for descriptions of other options you can set at this point.

<!-- Customize Squish.NET -->
<squish>
    <mapType>SampleData.SquishMap,SampleData</mapType>
</squish>

4c. Turn on Squish.NET for this application

<!-- Register Squish.NET for this app -->
<httpModules>
    <add name="SquishModule" type="SquishNet.UI.SquishModule, SquishNet, Version=1.0.0, Culture=neutral, PublicKeyToken=b37abc0311ba52e8"/>
</httpModules>

4d. Enable the Squish.NET resource delivery engine

<!-- Register the Squish.NET resource delivery mechanism -->
<httpHandlers>
    <add verb="*" path="Squish.axd" type="SquishNet.UI.SquishHandler, SquishNet, Version=1.0.0, Culture=neutral, PublicKeyToken=b37abc0311ba52e8"/>
</httpHandlers>

Complete Example web.config

<?xml version="1.0"?>
<configuration>

    <!-- Register the Squish.NET configuration section -->
    <configSections>
        <sectionGroup name="system.web">
            <section name="squish" type="SquishNet.UI.SquishSectionHandler, SquishNet, Version=1.0.0, Culture=neutral, PublicKeyToken=b37abc0311ba52e8"/>
        </sectionGroup>
    </configSections>
  
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <!-- Customize Squish.NET -->
        <squish>
            <mapType>SampleData.SquishMap,SampleData</mapType>
        </squish>
        
        <!-- Register Squish.NET for this app -->
        <httpModules>
            <add name="SquishModule" type="SquishNet.UI.SquishModule, SquishNet, Version=1.0.0, Culture=neutral, PublicKeyToken=b37abc0311ba52e8"/>
        </httpModules>
        
        <!-- Register the Squish.NET resource delivery mechanism -->
        <httpHandlers>
            <add verb="*" path="Squish.axd" type="SquishNet.UI.SquishHandler, SquishNet, Version=1.0.0, Culture=neutral, PublicKeyToken=b37abc0311ba52e8"/>
        </httpHandlers>
        
        <compilation debug="true">
            <assemblies>
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
        <authentication mode="Windows"/>
    </system.web>
</configuration>

Next: Squish.NET How-To Guide
Return to Top
Download Free Trial