Support » Plugin: Async JavaScript » If scripts are enqueued with dependency still async will be applied?

  • Hi,

    I am a plugin author.
    My plugin uses 3 script files and dependency is set in wp_enqueue_script().
    js/chunk-vendors.js
    js/chunk-common.js
    js/user.js

    1) But I could see still async attribute is added.
    I hope in this case your plugin should consider deferring it or leave it untouched.

    2) Do you have any hook to exclude my plugin from adding async?

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

    (@optimizingmatters)

    1. you’ll have to exclude wp-content/plugins/<your-plugin>/js
    2. afraid not, but you could simple add the above exclusion to the comma-separated aj_exclusions wordpress option? 🙂

    hope this helps,
    frank

    Thread Starter itsoft3g

    (@itsoft3g)

    Thank you for the quick reply.

    Won’t it will be better if you skip the scripts which have dependencies?

    Can you add a FAQ for plugin developers
    2 things – How you can make your scripts async attribute friendly.
    How to exclude my plugin scripts from async js.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    may do one day, but for now that’s not the case yet, so .. 😉

    Thread Starter itsoft3g

    (@itsoft3g)

    Looking forward, thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.