Handy Tip for CSS Reloading

CSS not refreshing in the browser can be a pain – Mark Jaquith has come up with an elegant solution to this for WordPress coders.

I saw this rather handy tip on CSS reloading on Mark Jaquith’s blog today.  Such a simple approach, but a great one for when you’re making CSS changes and need browsers to pick up on it immediately, rather than some hours down the line.

Some changes are critical.  Now you can version your css by hand, but you don’t have to.

The basis of the change is to use the code:

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

But for the detail, go read Mark’s post.

Author: David Coveney

I own the big bit of Standfirst, Interconnect, and Design Week. They keep me busy.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.