• Resolved swahlgren

    (@swahlgren)


    Hi and thanks for a great plugin.

    I’m having a bit of trouble with the “optimize CSS code” setting as it breaks my site i.e. causes it to not load as intended. Any suggestions as to how to get rid of the render blocking css “error” in google pagespeed while still rendering the website correctly?

    This is my website by the way: https://vpninfo.dk

    Best regards

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Frank Goossens

    (@futtta)

    had a look at your website with & without AO (one can disable AO on a per-request basis by adding ?ao_noptimize=1 to the URL) and both look the same, so I don’t see anything breaking (you’re “inlining all CSS”)?

    as for google pagespeed insights; great score, no blocking resources to be seen ??

    View post on imgur.com

    good job!
    frank

    Thread Starter swahlgren

    (@swahlgren)

    The site linked above seems to load ok now. However, I also use autoptimize on a multi-domain website and here only the main domain, i.e. the URL of the WP installation, loads as intended with CSS optimization enabled. The other domains serving the exact same files don’t.

    Main domain: https://getpopcorntime.org (loads fine with CSS optimization)

    Mirror domain: https://getpopcorntime.co.uk (doesn’t load fine with CSS optimization)

    Plugin Author Frank Goossens

    (@futtta)

    that’s because .co.uk has css from both .org and .co.uk in it, AO by default only aggregates from the domain which the request was for (.co.uk). you could either try setting CDN-url to //getpopcorntime.org or use the API to tell AO that the .co.uk and the .org are actually the same.

    frank

    Thread Starter swahlgren

    (@swahlgren)

    I see, that makes good sense. I tried setting .org as the CDN-url but it doesn’t work so I’m left with the API solution. Can you tell me how to accomplish telling it that the two domains are the same?

    S?ren

    Plugin Author Frank Goossens

    (@futtta)

    ok, try something like this;

    add_filter('autoptimize_filter_cssjs_multidomain','swahlgren_add_domains');
    function swahlgren_add_domains() {
        return array("getpopcorntime.org", "getpopcorntime.co.uk");
    }

    it might also be worth it to upgrade to the in-development version of AO which has significant improvement in the logic to decide what can and what can’t be aggregated. these changes will eventually be in the next release (no ETA yet), but if you want you can download the development-version here and overwrite your wp-content/plugins/autoptimize folder with the contents of autoptimize-master in the zip-file.

    frank

    Thread Starter swahlgren

    (@swahlgren)

    Help a brother out; where do I add the filter? ??

    Thanks for trying to help!

    Plugin Author Frank Goossens

    (@futtta)

    You can use the code snippets plugin or, if you know what you’re doing, add it to your child theme’s functions.php.

    Thread Starter swahlgren

    (@swahlgren)

    Upgraded to the development version and now it works!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Optimize CSS setting breaks site’ is closed to new replies.