• Resolved thoughtwell

    (@thoughtwell)


    I’m enqueuing two js scripts that both depend on jquery. Do I need to declare the $deps array on the second enqueue if it also relies on jquery?

    My thought is that declaring it on the first enqueue is sufficient and it would be redundant to declare the dependency if the second script depends on the same library as the first one.

    Can anyone confirm this or make any suggestions? I’m just starting to get the hang of enqueuing styles and scripts into themes, and I wonder how this is best handled.

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

    (@esmi)

    I don’t think there is a definitive answer to this but, in theory, declaring the jQuery dependency in the second enqueue will not cause any problems.

    Thread Starter thoughtwell

    (@thoughtwell)

    Great. I went ahead and did this… and so far, everything seems to be registering okay, so I’ll keep as is. Thanks for the feedback!

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

The topic ‘Is it necessary to declare dependency in second enqueue?’ is closed to new replies.