News

Far Future Expiration Header for nginx

Comments

published Thursday, March 21, 2013

Rails 3.1+ and the Asset Pipeline is excellent to minify, merge, and deliver assets, however it's good to also leverage browser caching.

Using nginx, you can set a far future expiration header like this:

server {
  location ~ ^/(assets)/ {
    expires max;
  }
}

PNG Optimization and PNG to favicon on OSX Mountain Lion

Comments

published Wednesday, March 20, 2013

PNG Optimization

It's always good to save a few bits when you deliver images on the web, a lot of information can be stripped out of an image without quality loss. To do so on OS X, currently Mountain Lion, I like 2 options:

Batch Convertion

Using ImageOptim

Command line

Using pngcrush

Install
brew update
brew install pngcrush
Usage
pngcrush -rem allb -brute -reduce favicon-32x32.png favicon-32x32-crushed.png

PNG convertion to ICO

Install

brew update
brew install png2ico

Usage

png2ico --colors 16 favicon.ico favicon-32x32-crushed.png