Skip to main content


Mantle provides a fluent wrapper on-top of WordPress' enqueue system. It relies on the wp-asset-manager package to provide a number of flexible methods for asset registration.

Mantle includes a Asset_Service_Provider class for managing asset registration. Assets can be registered in any of your service providers, too. You can use the Asset facade or the asset() helper method to quickly access the API:

Registering Assets

Assets can be enqueued in a fluent-basis on top of the existing WordPress API:

asset()->script( 'example-handle', mix( '/js/app.js' ) );

Assets can also be made to load with async and/or defer:

->script( 'example-handle', mix( '/js/app.js' ) )

The location the asset appears can also be controlled:

->script( 'example-handle', mix( '/js/app.js' ) )

->script( 'example-footer', mix( '/js/footer.js' ) )

You can also specify the asset's version and dependencies:

->style( 'example-styles', mix( '/css/app.css' ) )
->version( '1.0' )
->dependencies( [ 'unicorn-css' ] );

Laravel Mix

Mantle includes Laravel Mix by default to manage assets.