2009-11-06T19:57:51+01:00

4. less can be more

push-pins-chaos.jpg

Just look at the google.com and compare it to for example yahoo.com :-)

But I'm not going to compare those, rather I look where less is more at ba.pm.org. This is the case of CSS and JavaScript. To optimize this there are two transformations using YUI Compressor. From Makefile:

YUICOMPRESSOR=java -jar script/yuicompressor-2.4.2.jar

JS_FILES_TO_MINIFY=\
	src/js/01_jquery-1.2.6.js \
	src/js/02_jquery.sprintf-0.0.3.js \
	src/js/03_Gettext-0.04.js \
	src/js/04_i18n-0.04.js \
	src/js/05_thickbox-3.1.js \
	src/js/06_mongers.js \
	src/js/07_maps.js \
	src/js/08_dropShadow.js \
	src/js/08_jquery.cookies.2.1.0.js \
	src/js/09_feedback.js \

CSS_FILES_TO_MINIFY=\
	src/stylesheets/01_main.css \
	src/stylesheets/02_thickbox.css \

html/js/script.js: ${JS_FILES_TO_MINIFY}
	cat ${JS_FILES_TO_MINIFY} | ${YUICOMPRESSOR} --type js --charset UTF-8 -o $@

html/stylesheets/style.css: ${CSS_FILES_TO_MINIFY}
	cat ${CSS_FILES_TO_MINIFY} | ${YUICOMPRESSOR} --type css --charset UTF-8 -o $@

There are two more things to compress, but no-one had any touits to do it for ba.pm.org page. Still. One is the static html. It can be optimized by htmlclean. The other one are the picture files. There are plenty of tools to do so - pngout, optipng, pngcrush, jpegtran, pngquant, ...

Well and why? To save bandwidth, storage, download times => save money and at the same time enhance the user experience.

comments powered by Disqus