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!!! :slight_smile:

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:


<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.

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)”.

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.

Hi fretburner & Pullo

thank you for the info!

@ fretburner, I’ll check out the link!