-
Notifications
You must be signed in to change notification settings - Fork 8
Description
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.