Configuration
Configuration options for WPZylos Assets.
Vite Dev Server
Set the Vite dev server URL via constant in wp-config.php:
define('WPZYLOS_VITE_DEV_SERVER', 'http://localhost:5173');
Or use the hot file method (default):
# Vite automatically creates this file during `npm run dev`
echo "http://localhost:5173" > dist/hot
Asset Versioning
By default, assets use the plugin version from ContextInterface::version(). Override per-asset:
$assets->script('app')
->src('dist/js/app.js')
->version('2.1.0');
Manifest Location
By default, the ViteAssetResolver looks for manifest at:
{plugin_path}/dist/.vite/manifest.json
Custom Cron Schedules
The AssetManager does not use cron, but the AssetsServiceProvider hooks into:
wp_enqueue_scripts— Frontend assetsadmin_enqueue_scripts— Admin assets
Default Dependencies
Common WordPress script handles you can use as dependencies:
| Handle | Library |
|---|---|
jquery | jQuery |
wp-api | WordPress REST API client |
wp-api-fetch | Modern REST API fetch |
wp-element | React (WordPress wrapper) |
wp-components | WordPress UI components |
wp-i18n | Internationalization |
wp-data | WordPress data store |