• Resolved a4jp

    (@a4jpcom)


    Google PageSpeed Insights

    This plugin has blocking script and blocking CSS that causes a delay in rendering pages.

    plugins/wp-smartcrop/js/image-renderer.js
    wp-smartcrop/css/image-renderer.css

    Hope it’s not too tricky to fix.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter a4jp

    (@a4jpcom)

    Anything I can do to try and help?

    Thread Starter a4jp

    (@a4jpcom)

    Hope you find a good way to fix the problem. If you need any info send me a message anytime.

    This is not a bug. The renderblocking nature of the css and js incorporated in smartcrop is necessary for the plugin to be able to load images in their cropped state without a flash of unstyled content.

    Google’s Page Speed test has no way of testing the function of render-blocking scripts for speed or function, and should only ever be taken as a rough guide, not a hard rule.

    Thread Starter a4jp

    (@a4jpcom)

    Okay. Thank for the info.

    As it blocks other scripts from loading it would just be great if it was set to defer the script loading or load it asynchronously.

    I’m not sure of any ways to fix the CSS loading properly though. Maybe some plugin can smash the code together with the other CSS files.

    The JavaScript is enqueued with the footer flag set to true, so in properly coded themes, it will render in the footer, not blocking DOM loading. It only potentially blocks other external scripts, which is generally considered standard practice for scripts that have dependencies such as jQuery. This is because load order must be preserved. Async loading that preserves execution order is not well supported (in fact, IE is the only supporting browser), and is certainly not supported by WordPress’s best practices.

    If you are attempting to shorten load times, this mark from Google is likely a red herring, and not the underlying cause of any perceived slowness. I would suggest looking at server response times, resource sizes, and number of includes as much more important factors than a couple of kilobytes of JavaScript.

    In terms of minifying and combining your css and JS, there are plenty of plugins such as T3, Autoptimize, and Better WordPress Minify that you could look at to combine all your external resources into single files. However, none of these work well without significant manual tweaking.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Blocking script and blocking CSS that causes a delay in rendering’ is closed to new replies.