ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Working around CSS caching

October 14, 2008 11:12pm

Subscribe [4]
  • #1 / Oct 14, 2008 11:12pm

    mikeyhell

    81 posts

    I was just presented with a new problem I’ve never considered before which is how to handle the caching of CSS on a users browsers.  Some of the more creative solutions we’ve come up with are an .htaccess solution which will rename our style.css to style1.css style2.css based on what we set in the config and the one I like the most which is, if the boss doesn’t notice, it’s not a problem.

    Anyone able to shed some light on this?

  • #2 / Oct 15, 2008 12:06am

    Makc

    2 posts

    <?php
    $timestamp = time();
    ?>
    ../style.css?<?=$timestamp?>

  • #3 / Oct 15, 2008 12:12am

    mikeyhell

    81 posts

    haha ... so fitting that the next post is ‘if i only had a brain’

  • #4 / Oct 15, 2008 12:23am

    mikeyhell

    81 posts

    haha ... so fitting that the next post is ‘if i only had a brain’

    only thing is this will refresh everytime ... so just added:

    define(‘STYLE_V’,2);

    style.css?<?=STYLE_V?>

  • #5 / Oct 15, 2008 1:01am

    thurting

    213 posts

    The following article is about .js but it presents some interesting caching strategies.

    http://www.thinkvitamin.com/features/webapps/serving-javascript-fast

  • #6 / Oct 15, 2008 3:12am

    Colin Williams

    2601 posts

    I would look into learning how to control cache headers sent by Apache, since Apache is the one serving the CSS.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases