Vite
Implements
Uses
Properties
$nonce string|null
The Content Security Policy nonce to apply to all generated tags.
$integrityKey string|false
The key to check for integrity hashes within the manifest.
$entryPoints array
The configured entry points.
$hotFile string|null
The path to the "hot" file.
$buildDirectory string
The path to the build directory.
$manifestFilename string
The name of the manifest file.
$scriptTagAttributesResolvers array
The script tag attributes resolvers.
$styleTagAttributesResolvers array
The style tag attributes resolvers.
$preloadTagAttributesResolvers array
The preload tag attributes resolvers.
$preloadedAssets array
The preloaded assets.
$manifests array
The cached manifest files.
Methods
preloadedAssets ( ) : array
Get the preloaded assets.
cspNonce ( ) : string|null
Get the Content Security Policy nonce applied to all generated tags.
useCspNonce ( $nonce ) : string
Generate or set a Content Security Policy nonce to apply to all generated tags.
Parameters
- $nonce string|null
useIntegrityKey ( $key ) : $this
Use the given key to detect integrity hashes in the manifest.
Parameters
- $key string|false
withEntryPoints ( $entryPoints ) : $this
Set the Vite entry points.
Parameters
- $entryPoints array
useManifestFilename ( $filename ) : $this
Set the filename for the manifest file.
Parameters
- $filename string
hotFile ( ) : string
Get the Vite "hot" file path.
useHotFile ( $path ) : $this
Set the Vite "hot" file path.
Parameters
- $path string
useBuildDirectory ( $path ) : $this
Set the Vite build directory.
Parameters
- $path string
useScriptTagAttributes ( $attributes ) : $this
Use the given callback to resolve attributes for script tags.
Parameters
- $attributes callable|array
useStyleTagAttributes ( $attributes ) : $this
Use the given callback to resolve attributes for style tags.
Parameters
- $attributes callable|array
usePreloadTagAttributes ( $attributes ) : $this
Use the given callback to resolve attributes for preload tags.
Parameters
- $attributes callable|array|false
__invoke ( $entrypoints , $buildDirectory ) : HtmlString
Generate Vite tags for an entrypoint.
Parameters
- $entrypoints string|string[]
- $buildDirectory string|null
makeTagForChunk ( $src , $url , $chunk , $manifest ) : string
Make tag for the given chunk.
Parameters
- $src string
- $url string
- $chunk array|null
- $manifest array|null
makePreloadTagForChunk ( $src , $url , $chunk , $manifest ) : string
Make a preload tag for the given chunk.
Parameters
- $src string
- $url string
- $chunk array
- $manifest array
resolveScriptTagAttributes ( $src , $url , $chunk , $manifest ) : array
Resolve the attributes for the chunks generated script tag.
Parameters
- $src string
- $url string
- $chunk array|null
- $manifest array|null
resolveStylesheetTagAttributes ( $src , $url , $chunk , $manifest ) : array
Resolve the attributes for the chunks generated stylesheet tag.
Parameters
- $src string
- $url string
- $chunk array|null
- $manifest array|null
resolvePreloadTagAttributes ( $src , $url , $chunk , $manifest ) : array|false
Resolve the attributes for the chunks generated preload tag.
Parameters
- $src string
- $url string
- $chunk array
- $manifest array
makeTag ( $url ) : string
Generate an appropriate tag for the given URL in HMR mode.
Parameters
- $url string
makeScriptTag ( $url ) : string
Generate a script tag for the given URL.
Parameters
- $url string
makeStylesheetTag ( $url ) : string
Generate a stylesheet tag for the given URL in HMR mode.
Parameters
- $url string
makeScriptTagWithAttributes ( $url , $attributes ) : string
Generate a script tag with attributes for the given URL.
Parameters
- $url string
- $attributes array
makeStylesheetTagWithAttributes ( $url , $attributes ) : string
Generate a link tag with attributes for the given URL.
Parameters
- $url string
- $attributes array
isCssPath ( $path ) : bool
Determine whether the given path is a CSS file.
Parameters
- $path string
parseAttributes ( $attributes ) : array
Parse the attributes into key="value" strings.
Parameters
- $attributes array
hotAsset ( $asset ) : string
Get the path to a given asset when running in HMR mode.
asset ( $asset , $buildDirectory ) : string
Get the URL for an asset.
Parameters
- $asset string
- $buildDirectory string|null
content ( $asset , $buildDirectory ) : string
Get the content of a given asset.
Parameters
- $asset string
- $buildDirectory string|null
assetPath ( $path , $secure ) : string
Generate an asset path for the application.
Parameters
- $path string
- $secure bool|null
manifest ( $buildDirectory ) : array
Get the the manifest file for the given build directory.
Parameters
- $buildDirectory string
manifestPath ( $buildDirectory ) : string
Get the path to the manifest file for the given build directory.
Parameters
- $buildDirectory string
manifestHash ( $buildDirectory ) : string|null
Get a unique hash representing the current manifest, or null if there is no manifest.
Parameters
- $buildDirectory string|null
chunk ( $manifest , $file ) : array
Get the chunk for the given entry point / asset.
Parameters
- $manifest array
- $file string
isRunningHot ( ) : bool
Determine if the HMR server is running.
toHtml ( ) : string
Get the Vite tag content as a string of HTML.