bloom-ux/vite-manifest

Get js and css dependencies from a vitejs manifest file

dev-main 2022-03-30 20:56 UTC

This package is auto-updated.

Last update: 2022-06-30 21:34:28 UTC


README

Get js and css dependencies from a vitejs manifest file

Usage

$manifest = new Bloom_UX\ViteManifest( $manifest_file_full_path );
$manifest->setBaseUrl( 'https://domain.tld/assets/dist' );

$dependencies = $manifest->getEntryDeps( 'main.js' );

foreach ( $dependencies as $dep ) {
	if ( $dep->isEntry() ) {
		// load as javascript module
	} else if ( $dep instanceof JsDependency ) {
		// load as js
	} else {
		// loas as css
	}
}