Pages

Tuesday, June 14, 2005

CSS cache

One annoying thing about modifying themes and styles sometimes, is CSS caching. Although including a stylesheet in a page by using <link rel... tag is a good thing (because the stylesheet gets cached by the browser and is not downloaded again and again for all pages sharing the same stylesheets), this exact feature can become a bugger when you try to modify the CSS and instantly view the changes in the refreshed page.

I last encountered this problem when I was trying to modify this blog's theme by editing CSS files.

To overcome this problem I kept renaming the CSS file each time i made a modification to it by appending a version number on its name (i.e. base_1.css, and then base_2.css and so on).

This forced my browser to reload the new file.

If you have a better idea please share it with me.