Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brandcom/cakephp-vite
ViteHelper plugin for CakePHP and Vite JS
https://github.com/brandcom/cakephp-vite
bundler cakephp devserver es-modules hot-module-replacement legacy-support php vite vitejs
Last synced: 7 days ago
JSON representation
ViteHelper plugin for CakePHP and Vite JS
- Host: GitHub
- URL: https://github.com/brandcom/cakephp-vite
- Owner: brandcom
- Created: 2022-01-20T21:57:49.000Z (almost 3 years ago)
- Default Branch: cake5
- Last Pushed: 2024-03-22T03:25:47.000Z (8 months ago)
- Last Synced: 2024-06-17T05:27:09.336Z (5 months ago)
- Topics: bundler, cakephp, devserver, es-modules, hot-module-replacement, legacy-support, php, vite, vitejs
- Language: PHP
- Homepage:
- Size: 163 KB
- Stars: 18
- Watchers: 2
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# ViteHelper plugin for CakePHP 5
The plugin provides a Helper Class for CakePHP to facilitate the use of [Vite JS](https://vitejs.dev/).
When running the Vite dev server, the Helper provides the right script tags for hot module replacement and page
reloading.In production mode, the Helper loads the bundled files. `@vitejs/plugin-legacy` is supported, which will
insert `nomodule`-tags for older browsers, e.g. older iOS devices, which do not support js modules.> This readme is for **version 1.x.** If you are migrating from 0.x and something is unclear, read the Migration guide
> under `/docs`. Feel free to open an issue if you run into problems.## Installation
You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).
### CakePHP Version Map
| CakePHP version | Plugin Version | Branch | min. PHP Version |
|-----------------|----------------|--------|------------------|
| ^3.10 | / | cake3 | ^7.4 |
| ^4.2 | 0.x | master | ^7.4 |
| ^4.2 | 1.x | master | ^8.0 |
| ^5.0 | 2.x | cake5 | ^8.1 |The recommended way to install the plugin is:
```shell
composer require passchn/cakephp-vite
```Load the plugin in your Application.php:
```shell
bin/cake plugin load ViteHelper
```Load the Helper in your AppView.php:
```php
$this->loadHelper('ViteHelper.ViteScripts');
```## Usage
In your php-layout, include this in your html head:
```php
= $this->fetch('css') ?>
```Just before the closing `