Many browsers cache CSS files for a long time. A friend of mine had a particularly rough time getting to get Safari to refresh the CSS from his website. I told him that he could rename his file, and that would fix it. And it did. But who wants to rename their file, and the reference to the file every time they make changes? Well, you don’t have to rename the file… you can “pretend” to rename it.
This is a little trick I noticed that they are now doing with WordPress’s CSS… adding ?foo=bar
to the URI of the CSS (it’s not actually ?foo=bar
… any old thing will do). What I am doing now on my site is adding ?rev=X
to the end of my CSS URI, and just incrementing that rev
by one each time I make a change that I want to be publicly visible.
[…] refresh — Freshen your CSS the easy way […]