[resolved] Defer parsing of JavaScript (4 posts)

  1. ben52
    Posted 2 years ago #

    Hi Futta
    in http://gtmetrix.com/reports/ i have to defer your plugin, how it's come.
    http://xxxxxxx/wp-content/cache/autoptimize/autoptimize_e4b42cde913c50ba1d03d9fc5cab584a.js (145.5KiB)
    i think some thing wrong in the sitting, i have enable:

    Optimize HTML Code
    Keep HTML comments?
    Force JavaScript in <head>?
    Look for scripts only in <head>?
    Add try-catch wrapping?
    Optimize CSS Code?
    Inline all CSS?
    Save aggregated script/css as static files?

    any help pls.


  2. Frank Goossens
    Plugin Author

    Posted 2 years ago #

    JavaScript is only deferable if it is not forced in head. The problem you're probably facing is that you have (some) javascript that requires to be in head, hence the problem.

    An alternative could be not to "force in head", but to exclude all javascript that has to be in head one by one from Autoptimization. It might take some trial and error, but it will most certainly help you to defer your aggregated JS (although your excluded JS will still trigger the "defer parsing" message in gtmetrix, obviously)

    hope this help,

  3. ben52
    Posted 2 years ago #

    Hi Frank,
    i disable force in head and now it's ok

    one question pls. to inline all css i must enqueue all of them in my child theme ???
    or i can enqueue only my child css

  4. Frank Goossens
    Plugin Author

    Posted 2 years ago #

    when using child themes Autoptimize will read the CSS of the child theme and recursively import other CSS (parent CSS + imports in there as well).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.