juster/wordpress-vite
Composer 安装命令:
composer require juster/wordpress-vite
包简介
A library to properly integrate a Vite workflow into WordPress.
关键字:
README 文档
README
A library to properly integrate a Vite workflow into WordPress.
Requirements
- PHP 7.4 or higher;
- WordPress 6.5 or higher;
- A valid Vite configuration using the npm module vite-plugin-wordpress.
How it works
All the logic for resolving paths to assets generated by Vite is located in the core of the library.
All you have to do is instantiate the module by passing two parameters:
- the path to the
vite.config.phpconfiguration file generated by the previously installedvite-plugin-wordpressnpm module; - the current Wordpress environment type (production or whatever else).
use Juster\WordpressVite\App; function vite(): App { return App::get(ABSPATH, WP_ENVIRONMENT_TYPE); } vite();
You may need an autoloader for this. Composer can help you with that.
Then, you can include your CSS & JavaScript files in this way:
function theme(): void { vite()->assets()->enqueueStyle('theme', 'src/styles/main.css'); vite()->assets()->enqueueScript('theme', 'src/scripts/main.js'); } add_action('wp_enqueue_scripts', 'theme');
For other static files that need to be included in templates, such as images, you can proceed as follows:
<img src="<?= vite()->assets()->resolve('src/assets/images/placeholder.webp') ?>" alt="A wonderful image" />
And if you prefer to avoid this verbosity, you can declare a small utility function, such as this one, for example:
function asset($path): string { return vite()->assets()->resolve("src/assets/$path"); }
This results in the following in the templates:
<img src="<?= asset('images/placeholder.webp') ?>" alt="A wonderful image" />
juster/wordpress-vite 适用场景与选型建议
juster/wordpress-vite 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 145 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「vite」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 juster/wordpress-vite 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 juster/wordpress-vite 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 juster/wordpress-vite 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Injects assets from a Vite manifest to the Wordpress head, supports themes and plugins
Pimcore Vite integration
Minimal Laravel authentication scaffolding with Vue, Vite, Typescript and Tailwind.
Live-reloads the open frontend tabs affected by a content or source-file change, using TYPO3 cache tags and rendered-file tags to reload only the affected tabs.
Must-use plugin integrating WordPress with the Upsun platform: environment awareness, router-cache friendliness, safe preview clones, deploy migrations, Site Health checks, and a wp upsun CLI command.
laravel vue spa
统计信息
- 总下载量: 145
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-19