I've installed mod_pagespeed on our server but it won't combine my CSS and JS on our website oktoberfest.it. Obviously I've activated combine_css, combine_javascript and PassThrough in filters in pagespeed.conf file.
I've also read that mod_pagespeed can't combine CSS files that contains CSS3 directives, but in my Apache's log file, after enabling LevelLog debug of course, there aren't any error or infos about failures in combining. Neither CSS neither JS.
I've tried to:
I don't know what to do now. I'm done with ideas. I really want this mod_pagespeed features work with our website, we have 40 requests of CSSs and JSs that come from plugins that we can not manage.
What do you suggest me to do?
For CSS Combine
As you are using Wordpress, you need to add a Function in
function.php
of Wordpress.
function remove_style_id($link) {
return preg_replace("/id='.*-css'/", "", $link);
}
add_filter('style_loader_tag', 'remove_style_id');
Wordpress writes ID=""
Tags into the css link which pagespeed doesn´t like. So it will be ignored.
BUT It "could" cause Problems with a Plugin if a Javascript calls the ID, but regular no one will do it that way. So you´ll be safe.
You can permit IDs for css combining as of version 1.12.34.1, have a look at the documentation.
As wordpress adds -css
to any ID, you can just add:
Apache:
ModPagespeedPermitIdsForCssCombining *-css
Nginx:
pagespeed PermitIdsForCssCombining *-css;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With