Support » Plugin: Autoptimize » Failed to execute ‘insertRule’ on ‘CSSStyleSheet’: Cannot access StyleSheet

  • Resolved ColinD

    (@colind)


    Our site is hosted on WP Engine and autoptimize worked as expected on dev and staging but when I activated it on production (with WP Engine caching and CDN) I got the following error in the console:
    Failed to execute ‘insertRule’ on ‘CSSStyleSheet’: Cannot access StyleSheet to insertRule
    Unchecking “optimize CSS Code” eliminates the error.

    Any advice on how to further diagnose and correct the issue would be greatly appreciated.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    in what browser do you get that error/ warning ColinD? and what are/ were your CSS optimization settings?

    Thread Starter ColinD

    (@colind)

    Chrome 69, Mac OS Mojave

    I played with all the settings options before posting. If I check “Optimize CSS” on the first tab and leave everything as-is on the extra tab (google fonts: leave as is, optimize images: unchecked, remove emojis: unchecked, remove query string: unchecked) The error is present. If I try any of the extras it doesn’t change the error.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, instead of diving in to settings; I’m pretty sure you have a staging site, no? can we enable CSS opt. there so we (I) can see what happens?

    Thread Starter ColinD

    (@colind)

    Sure. It works as expected on staging and dev. It’s on WP Engine hosting. My guess is that it is somehow related to the WP Engine production environment’s cache and/or CDN. How can I share access info to the staging site with you?

    Thanks for you assistance

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you can mail me at futtta-at-gmail-dot-com 🙂

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, good and bad news;
    -> the bad is that i don’t know why this would not work on the live site while it does work on dev/stating (Autoptimize does not use insertRule)
    -> there are multiple references to this JS error and the consensus seems to be it is better to have JS add a new stylesheet instead of adding rules to existing ones (see for example https://github.com/sampotts/rangetouch/issues/12)
    -> the good is that I was able to find the (js-)code that is doing the insertRule; it’s in wp-content/themes/userzoom2017/js/scripts.js, so you might want your devs to look into that

    hope this helps,
    frank

    Thread Starter ColinD

    (@colind)

    Thanks so much for digging into this for me. I’ve fixed up my code.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome Colin, feel free to leave a review of the plugin and support here! 🙂

    enjoy the weekend!
    frank

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Failed to execute ‘insertRule’ on ‘CSSStyleSheet’: Cannot access StyleSheet’ is closed to new replies.