Sunday, December 07, 2008 1:50 PM
Please check this post, it is the successor to this post. Thank you.
I have updated sss.aspx to include a couple of more features and here is what it can do for you now.
- The most important benefit is it allows you to combine several script files (CSS or js) into one file to return to your client, this helps increase performance of your website by minimizing the http requests the page requires.
- The returning stream tries to use GZip compression if supported by the client browser. This further increases load speeds of your site.
- You can specify default script files to include always.
- Proper cashing headers and proper generation of 302 response codes (not modified) to minimize the transfer of scripts to the client browser. Script files are sent back to the client browser only if they have been modified. Two headers are processed to achieve this, "If-Modified-Since, Last-modified" and "If-None-Match, ETag".
To use sss.aspx, it is very simple.
1. add the file sss.aspx it to your site (no need to recompile).
2. instead of including your script files like this:
Add this now.
Note how the file common.js was omitted from the list, this is because the files sample.js and engine.js start with the comment:
/* <sss include="common.js"/> */
This comment will make sss.aspx combine the file common.js with sample.js and engine.js in the proper order and serve them back as one file.
If you have any comments, please let me hear about them. I tried to be straight to the point in this post, if some things are not clear enough, let me know and I will gladly explain more. You can use fiddler2 (http proxy debugger) to check the results of using sss.aspx.
Another important tip for increasing your site's load speeds is to enable "Content Expiration" in IIS.
Download the latest sss.aspx file here