I've spend the last few days building a .NET implementation of a gzip
packer.  It accepts an argument like either of these two:

 

<script type="text/javascript" src="JSPacker.ashx?F=~/script.js"></script>

<script type="text/javascript"
src="JSPacker.ashx?F=AssemblyName:Resources.jquery.js"></script>

 

It will also accept a semicolon-delimited list of files and will stream them
back as a single file.

 

I took Dean Edwards packer, updated the .NET implementation, and used the
built-in gzip library to perform the compression.

 

The basic idea is that you can have fully readable, uncompressed javascript
as a resource in your assembly or saved in a directory on your website.
When you run the website in debug mode (Cassini server) the files are not
minified.  In a production environment, the source files are minified,
gzipped and cached on the server.

 

I did some testing and it appears to be working very well for me, although
the jQuery source file was only compressed down to 16.5kb (instead of
14.5kb).  This may be due to the MS implementation of Gzip, but I'm not
sure.

 

I can't host this for download on my company's website for various reasons,
but I'd happily send the source code and binaries (strong-named for use in
the GAC) to anyone who wants it.

 

JK

Reply via email to