<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vastermonster &#187; Article</title>
	<atom:link href="http://vastermonster.com/blog/c/article/feed" rel="self" type="application/rss+xml" />
	<link>http://vastermonster.com/blog</link>
	<description>is Paul Thrasher&#039;s personal blog. This is my space to write and post whatever I&#039;m into at the moment. I will mostly post about php code, design, strange videos, internet chaos, simplicity and cleverness — fairly in-often.</description>
	<lastBuildDate>Tue, 06 Apr 2010 06:03:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<cloud domain='vastermonster.com' port='80' path='/blog/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Asset Compression with YUI Compressor, Minify and OptiPNG</title>
		<link>http://vastermonster.com/blog/asset-compression</link>
		<comments>http://vastermonster.com/blog/asset-compression#comments</comments>
		<pubDate>Fri, 07 Aug 2009 00:27:21 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://vastermonster.com/blog/?p=108</guid>
		<description><![CDATA[One of the best ways to speed up rendering of your website is to compress all your assets: JavaScript, CSS and images. Yahoo! has all but perfected this. The best way of compressing these files is using Yahoo!&#8217;s YUI Compressor. Here&#8217;s how. Get the YUI Compressor YUI Compressor can be found at Yahoo! here: Docs: [...]]]></description>
			<content:encoded><![CDATA[<p>One of the best ways to speed up rendering of your website is to compress all your assets: JavaScript, CSS and images. Yahoo! has all but perfected this. The best way of compressing these files is using Yahoo!&#8217;s YUI Compressor. Here&#8217;s how.</p>
<h3>Get the YUI Compressor</h3>
<p>YUI Compressor can be f<span style="font-weight: normal; font-size: 13px;">ound at Yahoo! here:</span></p>
<ul>
<li><strong>Docs:</strong> <a href="http://developer.yahoo.com/yui/compressor/">http://developer.yahoo.com/yui/compressor/</a></li>
<li><strong>Download:</strong> <a href="http://yuilibrary.com/downloads/#yuicompressor">http://yuilibrary.com/downloads/#yuicompressor</a></li>
<li><strong>Source:</strong> <a href="http://github.com/yui/yuicompressor/tree/master">http://github.com/yui/yuicompressor/tree/master</a></li>
</ul>
<p>Once downloaded, you can run the compressor via command-line. Java is required.</p>
<pre style="margin-top: 1em; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: monospace; line-height: 13px; padding: 0px;">$ java -jar yuicompressor-x.y.z.jar
$ java -jar yuicompressor-x.y.z.jar myfile.js -o myfile-min.js</pre>
<h3 style="font-size: 1.17em;">The YUI Compressor Ruby Gem</h3>
<p>You can also use a ruby gem to install and run the compressor. Compressing files is a little more difficult, check the documentation to learn how.</p>
<p><a href="http://github.com/sstephenson/ruby-yui-compressor/tree/master">http://github.com/sstephenson/ruby-yui-compressor/tree/master</a></p>
<pre>$ sudo gem install -r yui-compressor
$ irb -rubygems
&gt;&gt; require "yui/compressor"
compressor = YUI::JavaScriptCompressor.new
compressor.compress('var JS = "goes here";')</pre>
<p>There are a few options for compressing and serving assets on the fly. Gzip compression via Apache is common and usually turned on by default on your server. In addition to that, I use Minify. It takes some time to setup but it&#8217;s worth it.</p>
<h3>Minify PHP</h3>
<ul>
<li><strong>Project page:</strong> <a href="http://code.google.com/p/minify/">http://code.google.com/p/minify/</a></li>
<li><strong>Docs:</strong> <a href="http://code.google.com/p/minify/wiki/UserGuide">http://code.google.com/p/minify/wiki/UserGuide</a></li>
<li><strong>Download:</strong> <a href="http://code.google.com/p/minify/downloads/list">http://code.google.com/p/minify/downloads/list</a></li>
<li><strong>Source:</strong> <a href="http://code.google.com/p/minify/source/checkout">http://code.google.com/p/minify/source/checkout</a></li>
</ul>
<p>The documentation is pretty clear, so I won&#8217;t copy it here. Either way, you&#8217;ve got smaller files. Running the command manually gives you a lot more control over how it works and where the files end up. But setting up a Minify &#8220;server&#8221; lets you compress all your files without worrying about missing anything. They both work great.</p>
<h3>Image Compression with OptiPNG</h3>
<p>Recently we&#8217;ve started compressing our images as well. Images are probably the most common asset format found on your webpage so it&#8217;s important to get them downloaded smoothly. I haven&#8217;t found a great tool for this yet but once again, Yahoo! provides. These tools provide lossless compression, which means you won&#8217;t see any visual difference in the file, only in the final file size. Most of the tools I&#8217;ve found work best on png files, which is a great format to work with since it provides 24 bit alpha channels (better transparency) unlike gif or jpgs.</p>
<ul>
<li><strong>Yahoo! Smush-It:</strong> <a href="http://developer.yahoo.com/yslow/smushit/">http://developer.yahoo.com/yslow/smushit/</a><br />
Smush it does not yet have a public tool or API, but they&#8217;re working on it. It does a great job on png files. To compress the files, you have to place them on the internet and give the tool the urls. A better workaround is to use the tool via YSlow in Firebug.</li>
<li><strong>OptiPNG:</strong> <a href="http://optipng.sourceforge.net/">http://optipng.sourceforge.net/</a><br />
OptiPNG has great compression, a command-line tool and a <a href="http://www.amake.us/software/pngcrusher/">GUI wrapper for OS X</a>. The only downside is that it only works on png files. The GUI wrapper gives you a drag and drop tool for compressing your files.</li>
</ul>
<p>How have you been compressing <em>your</em> files?</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/vastermonster.com/blog/p=108</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
