SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jul 2013
    Location
    South of the equator, then turn left
    Posts
    364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS cache setup for Respond.js polyfill – CSS3 media queries

    Greetings everyone!

    Has anyone used the polyfill Respond.js in their website?


    According to the documentation on the GitHub website, under “How's it work”, I need to configure the css files' caching in order to avoid a re-request going to the server. I believe this is only relevant for IE users?

    I have no idea what I'm supposed to do. Could someone please enlighten me?

    Thank you very much!!!

  2. #2
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,438
    Mentioned
    45 Post(s)
    Tagged
    13 Thread(s)
    Hi,

    You can configure caching for your css files by editing your .htaccess file in the root directory of your site.
    The commands you need to add would be something like this:
    Code:
    <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresByType text/css                              "access plus 1 year"
    </IfModule>
    You might want to take a look at this sample .htaccess file to see what other caching settings can be used.

  3. #3
    Grόίe aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,999
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    I used respond.js on a couple of projects, as I found it to be considerably less buggy than css3-mediaqueries-js.
    It has always worked out of the box for me.
    I always thought (though I might be wrong) that browsers cache CSS stylesheets by default.
    I understood the "How to use" section to mean "ensure that you have taken no steps to counteract this (for example by appending a timestamp to your css files as a parameter)".

  4. #4
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,438
    Mentioned
    45 Post(s)
    Tagged
    13 Thread(s)
    Quote Originally Posted by Pullo View Post
    I always thought (though I might be wrong) that browsers cache CSS stylesheets by default.
    I understood the "How to use" section to mean "ensure that you have taken no steps to counteract this (for example by appending a timestamp to your css files as a parameter)".
    Hey Pullo,

    Good point.. I believe CSS is cached by default, but I've no idea for how long. I've just done a quick search but it seems difficult to find any concrete figures, and I imagine it will vary between browsers.

  5. #5
    SitePoint Addict
    Join Date
    Jul 2013
    Location
    South of the equator, then turn left
    Posts
    364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi fretburner & Pullo

    thank you for the info!

    @ fretburner, I'll check out the link!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •