How-To Guide: JavaScript/CSS Development with Squish.NET

Add resources to your project as 'Embedded Resources'

Mark as Embedded Resources

Add your JavaScript and CSS resources to the assembly you created to hold resources to be squished. Click on each of the files, move to the "Properties" window, and under "Build Action" select "Embedded Resource".

Whenever you modify these files, simply build the project just like you would any other .NET project to make the changes available to your website.

Modify your SquishMap class to map to each of your embedded resources

Your SquishMap class contains the mapping for all of your embedded resources. Created nested classes within this class to match the folder structure of your project. Create members within each class to represent each embedded resource. The name you give to each member will be the key used by your website to register that particular resource.

SquishMap Details
Easliy Register Resources

Register resources in your application

In your pages and controls, simply make a call to Squish.Current.Register to register a particular resource at any point in the page life cycle. Registering a resource will cause it to be included in the single, compressed resource that will be delivered to the user's browser.

Ensure Your SquishMap is Working Correctly

To ensure that your resources assembly is set up correctly, use the built-in diagnostics of Squish.NET. Navigate your browser to
[YOUR APPLICATION URL]/Squish.axd?performDiagnostics=true

The 'Status' column will alert you to any errors due to a mis-configured SquishMap and provide you with help as to how to correct the situation.

Perform Diagnostics


Next: Advanced Usage / Extending Squish.NET
Return to Top
Download Free Trial