kaiseki / wp-inpsyde-assets
Companion module for inpsyde/assets
1.0.0
2026-06-02 09:05 UTC
Requires
- php: ^8.2
- inpsyde/assets: ^2.8
- kaiseki/config: ^2.0
- kaiseki/wp-env: ^1.0
- kaiseki/wp-hook: ^2.0
- oscarotero/env: ^2.1
- psr/container: ^1.1 || ^2.0
- thecodingmachine/safe: ^2.0
Requires (Dev)
- bnf/phpstan-psr-container: ^1.1
- kaiseki/php-coding-standard: ^1.0
- maglnet/composer-require-checker: ^4.0
- php-stubs/wordpress-stubs: ^6.2
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.0
- roave/security-advisories: dev-latest
- szepeviktor/phpstan-wordpress: ^2.0
- thecodingmachine/phpstan-safe-rule: ^1.4
This package is auto-updated.
Last update: 2026-06-02 23:45:37 UTC
README
Companion module for inpsyde/assets that registers a Vite
build's manifest.json entries as WordPress assets and wires up a Vite dev-server client.
It provides:
ViteManifestLoader— aninpsyde/assetswebpack-style loader that parses a Vitemanifest.jsonintoScript/Styleassets (by extension), with optional handle prefixing and a configurable directory URL.ViteManifestRegistry— akaiseki/wp-hookHookProviderInterfacethat, on theinpsyde/assetssetup action, loads the configured manifests, applies per-handle script/style filters, optionally tags scripts as ES modules, and registers them with theAssetManager.ViteClient— injects the@vite/clientdev script into the page when the Vite dev server is running (detected on local/development environments viakaiseki/wp-env).
Installation
composer require kaiseki/wp-inpsyde-assets
Requires PHP 8.2 or newer.
Usage
Register ConfigProvider with your laminas-style config aggregator and activate the providers via
kaiseki/wp-hook. Configure the manifests and the dev-server client under their config keys:
use Kaiseki\WordPress\InpsydeAssets\Registry\ViteManifestRegistry; use Kaiseki\WordPress\InpsydeAssets\ViteClient\ViteClient; return [ 'vite_client' => [ 'host' => 'localhost', 'port' => 5173, ], 'vite_manifest' => [ // list of manifest.json paths, or callables receiving the ViteClient 'files' => [get_theme_file_path('dist/manifest.json')], 'autoload' => true, 'handle_prefix' => 'theme-', 'es_modules' => true, // optional per-handle filters: handle => callable|bool 'scripts' => [], 'styles' => [], ], 'hook' => [ 'provider' => [ ViteClient::class, ViteManifestRegistry::class, ], ], ];
VITE_HOST and VITE_PORT environment variables override the configured dev-server host/port.
Development
composer install
composer check # check-deps, cs-check, phpstan
License
MIT — see LICENSE.