Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Raul P.

    (@alignak)

    Please read the faqs:
    https://www.ads-software.com/plugins/fast-velocity-minify/faq/

    You cannot simply enable deferring for scripts, just because gtmetrix tells you to do it… you need to ensure, your scripts support it (hire a developer).

    If you defer jquery for example, and then any of your plugins, theme or any custom code uses jquery in any inline script… that code will not run and trigger an error, because jquery is not yet defined when you run the inlined script.

    “Enable defer parsing of FVM JS files globally” will force all scripts that are detected by FVM to be deferred, however, this only works for scripts that were properly enqueued by themes or plugins.
    It doesn’t work if someone just went and hardcoded some scripts directly in the header, without following the official documentation for wordpress.

    For the FVM files, the one in the header should not be deferred. and it should not matter.
    The plugin and theme authors can choose to enqueue files on both header and footer.
    Anything in the header, usually means it should be render blocking according to their specification, as it was designed that way.

    If you force it to be deferred, the same will happen as I described above.
    The file will no longer be processed before the remaining code, meaning, those inlined scripts will not run because they expected the files in the header to be there.

    Obviously, this is not always true form 100% of the cases, hence you need a developer or advanced user to decide if scripts can be deferred or not.

    Thread Starter rcanfiel

    (@rcanfiel)

    thanks for the answer. I had a developer, but he is no longer able to perform his responsibilities.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cant seem to defer JS, even though it looks right’ is closed to new replies.