ThoughtCraft
Auto-update version of css

Auto-update version of css

I just stumbled across this on Mark Jaquith’s blog.

It’s a really handy way of getting around the automatic caching that happens to css files.

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" type="text/css" media="screen, projection"

Basically it uses the timestamp as the variable that changes. Anytime you update the css file any browser will think it’s a new file and go and get it.

Simple and useful - thanks Mark!

via: http://markjaquith.wordpress.com/2009/05/04/force-css-changes-to-go-live-immediately/

Author's Note: I’ve chosen to preserve these thoughts as they were originally shared. Some external links or references may no longer work. I’m leaving them intact to maintain their original context and spirit.