Download the PHP package idleberg/wordpress-vite-assets without Composer
On this page you can find all versions of the php package idleberg/wordpress-vite-assets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download idleberg/wordpress-vite-assets
More information about idleberg/wordpress-vite-assets
Files in idleberg/wordpress-vite-assets
Package wordpress-vite-assets
Short Description Injects assets from a Vite manifest to the Wordpress head
License MIT
Informations about the package wordpress-vite-assets
Vite Assets for WordPress
Adds assets from a Vite manifest to the WordPress head, supports themes and plugins
Table of contents
- Installation
- Usage
- Methods
inject()
getScriptTag()
getStyleTags()
getPreloadTags()
- Options
option.action
option.crossorigin
option.integrity
option.priority
- Methods
- License
Installation
composer require idleberg/wordpress-vite-assets
Usage
To get you going, first instantiate the class exposed by this library
Example
Methods
inject()
Usage: inject(array|string $entrypoints, array $options = [])
Injects tags for entries specified in the manifest to the page header
- script entrypoint
- preloads for imported scripts
- style tags
getScriptTag()
Usage: getScriptTag(string $entrypoint, array $options = [])
Returns the script tag for an entry in the manifest
getStyleTags()
Usage: getStyleTags(string $entrypoint, array $options = [])
Returns the style tags for an entry in the manifest
getPreloadTags()
Usage: getPreloadTags(string $entrypoint)
Returns the preload tags for an entry in the manifest
Options
option.action
Type: null | string
Allows overriding the default action for the inject()
method.
Example
:warning: It's unlikely that you want to change the default action, so don't override unless you know what you're doing!
option.crossorigin
Type: boolean | "anonymous" | "use-credentials"
Toggles crossorigin
attribute on script and style tags, or assigns a value
option.integrity
Type: boolean
Toggles integrity
attribute on script and style tags
option.priority
Type: int | array
Allows overriding the priority for the inject()
method. It allows granular control when provided as an array:
Example
License
This work is licensed under The MIT License