Skip to content

Support $args for wp_enqueue_script #6

@joezappie

Description

@joezappie

The wp_enqueue_script function supports two $args for how the script should be enqueued and where:

  • $args
    • strategy Optional. If provided, may be either 'defer' or 'async'.
    • in_footer Optional. Whether to print the script in the footer. Default 'false'.

This would be useful for optimizing code so its non-blocking improving page speed. Right now all scripts come is as blocking.

From what I can tell, this would simply be adding an additional property to the Asset class, adding another parameter to enqueueAsset() and then just passing it as the last arg when actually enqueuing it in ViteCompiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions