Support » Plugin: Autoptimize » Also aggregate inline JS

  • Resolved martychc23

    (@martychc23)


    Hi, for the option:

    “Also aggregate inline JS? Let Autoptimize also extract JS from the HTML”

    Can we enable this for a single file only?

    I find enabling this option enables me to remove the render blocking jquery without breaking any functionality. So it would be could to do this for that file only if possible?

    Thanks

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

    (@optimizingmatters)

    yes, with a workaround; tick “also aggregate inline JS” and add a bunch of stuff to the JS opt. exclusion list to have all but that one block aggregated?

    Do you mean allow AO to aggregate my JS as normal, but the file i want for the “also aggregate inline JS” option (e.g., jquery.js) i should put in the exclusion list?

    In other words, the files in the exclusion list are what “also aggregate inline JS” option applies to?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    no, the inverse;
    * tick “also aggregate inline JS”
    * add exclusions for all but the inline JS you want to keep in place

    frank

    ok, i think i’ve managed to do what was intended but i’m not sure why it works?

    When i have jquery.js in exclusion list it makes it render blocking.

    If i remove jquery.js from exclusion list, i get “js undefined error”)

    I understand why those happen, but i don’t get why enabling “also aggregate inline JS” fixes the js undefined errors even though i still don’t have jquery.js in the exclusion list?

    So basically “also aggregate inline JS” gives me the best of both worlds by not having to exclude jquery.js and avoiding the errors that come with excluding it. But why?

    I’m interested because having this configuration reduces 1 sec of my page load according to lighthouse, so it’s quite a significant improvement!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    because the JS that requires jQuery to be available is aggregated when “also aggregate inline JS” is ticked 🙂

    the reason that option is off by default is because inline JS often contains (semi-)unique strings that bust Autoptimize’s cache, which you don’t want either I’m sure 😉

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Also aggregate inline JS’ is closed to new replies.