• drod7425

    (@drod7425)


    Hello,

    I’m developing a custom theme for my company’s web site based upon the Underscores starter theme and Bootstrap. I’ve been running performance audits in Google Developer tools and one of the audits says that I’m loading external javascript before external css.

    Now, I’ve already made sure to enqueue my styles before my scripts, but one of the plugins I’m using – Easy Twitter Feed Widget – is hooking one of their script dependencies before my styles.

    I see the bit of code that is doing this and I could hook it in a different way, but my changes would be lost every time the author updates their plugin. Is there anyway to override this behavior other than editing the plugin?

    Thanks,
    Dave

    PS WordPress also seems to be injecting their emojis javascript before my styles. Any way to move this to the bottom?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Hi @drod7425

    What I’m wondering is why you think the changes would be lost if the plugin is updated?

    One way I can think of would be by changing the hook priorities on both the emoji and the Twitter feed one.

    Thread Starter drod7425

    (@drod7425)

    Hey @jcastaneda,

    Thanks for the reply.

    What I’m wondering is why you think the changes would be lost if the plugin is updated?

    To clarify, the code that I’m referring to resides in one of the plugin’s scripts. Maybe I’m mistaken, but I was under the impression that if I edit that code, any future update to that plugin would override my changes. Is this not true?

    One way I can think of would be by changing the hook priorities on both the emoji and the Twitter feed one.

    From what I’m seeing the plugin enqueues a script that uses DOM manipulation to insert a different script where it wants. So I can change the priority on the initial script, but the enqueued script will still put the secondary one where it wants.

    As for the emojis, it’s part of the WordPress core. Similar problem as with the plugin, where if I update it, I can expect to lose the changes.

    Thanks,
    Dave

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Plugin Scripts Messing Up Performance Optimization’ is closed to new replies.