arbims / vite-plugin
VitePlugin plugin for CakePHP
Installs: 300
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=7.4
- cakephp/cakephp: ^5.0.1
Requires (Dev)
- phpunit/phpunit: ^8.5 || ^9.3
README
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require arbims/vite-plugin
Load the plugin in your Application.php:
bin/cake plugin load VitePlugin
Load the Helper in your AppView.php:
$this->loadHelper('VitePlugin.Vite');
add config Vite environment in /config/bootstrap.php
Configure::write('IS_DEV', true);
Usage
run this command
if you want use vue replace react with vue or preact
bin/cake vite_plugin react
In your php-layout, include this in your html head:
<?= $this->Vite->assets('js/main.jsx', \Cake\Core\Configure::read('IS_DEV'), 'react') ?>
if want to use vue
<?= $this->Vite->assets('js/main.js', \Cake\Core\Configure::read('IS_DEV')) ?>
then run
npm install
npm install -D sass
npm run dev
wee nedd change IS_DEV variable false if we are in production.
Configure::write('IS_DEV', false);
then run
npm run build