Skip to content

canEnqueue for 3rd party registered assets? #19

@lkraav

Description

@lkraav

Is your feature request related to a problem? Please describe.
There are assets that need to be only conditionally loaded in specific contexts, such as payment gateway scripts not necessary anywhere outside of WooCommerce is_checkout()

Describe the solution you'd like
New OutputFilter could accept an array of callbacks, or a boolean result to determine whether the asset should be enqueued at all.

This should also work for controlling non-Inpsyde\Asset dependencies. We should be able to initialize any externally enqueued handle to an Inpsyde\Asset object, then apply any OutputFilters as usual.

Describe alternatives you've considered
Not sure, are there any?

Additional context
I'm looking to better control my own and various 3rd party assets enqueued to only specific contexts, to optimized asset payloads for increased page load speed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions