WordPress.org

Ready to get started?Download WordPress

Forums

Autoptimize
[resolved] Defer parsing of JavaScript (4 posts)

  1. ben52
    Member
    Posted 4 months 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.
    Thanks

    https://wordpress.org/plugins/autoptimize/

  2. futtta
    Member
    Plugin Author

    Posted 4 months 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,
    frank

  3. ben52
    Member
    Posted 4 months 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
    thanks
    Ben

  4. futtta
    Member
    Plugin Author

    Posted 4 months 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).

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.