PHP code example of larsgowebdev / vite-asset-collector-wp
1. Go to this page and download the library: Download larsgowebdev/vite-asset-collector-wp library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
larsgowebdev / vite-asset-collector-wp example snippets
use Larsgowebdev\ViteAssetCollectorWp\ViteAssetCollector;
use Larsgowebdev\ViteAssetCollectorWp\Exception\ViteException;
use Larsgowebdev\ViteAssetCollectorWp\ErrorHandler\ViteErrorHandler;
try {
$vite = new ViteAssetCollector(
'/.vite/manifest.json', // Path to manifest relative to theme
'frontend/vite.entry.js' // Entry point path
);
$vite->injectViteAssets();
} catch (ViteException $e) {
(new ViteErrorHandler())->handleError($e);
}