Question

I am using rewrite_css config and found a problem. Conditional CSS files inside HTML comments are ignored by mod_pagespeed.

    <!--[if (IE 7) | (IE 8)]>
        <link href="mycss.css" rel="stylesheet"/>
    <![endif]-->

However, this style does work:

    <!--[if (IE 7) | (IE 8)]><!-->
        <link href="mycss.css" rel="stylesheet"/>
    <!--<![endif]-->

The first of the two is ignored by browsers, which do not support conditional comments. The second isn't. Bottom line: there are subtle differences between the two: http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx#dlhidden

So I don't want to change how the page is set up as it can have negative consequences. Ideally, I'd like to coax mod_pagespeed into rewriting the css inside the comment. Are there any ways to make that happen?

Was it helpful?

Solution

This is not currently supported. mod_pagespeed only rewrites things that are not in comments.

There are two open feature requests for this though: https://code.google.com/p/modpagespeed/issues/detail?id=553 https://code.google.com/p/modpagespeed/issues/detail?id=288

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top