Vite is a modern frontend build tool that provides an extremely fast development environment and bundles your code for production.
This plugin configures Vite for use with a CodeIgniter backend server.
This plugin is based on the Laravel Vite plugin.
Install with composer:
composer require monster010/codeigniter-vite-plugin
Publish default resources (package.json, vite.config.js, tailwind.config.js, etc.)
php spark vite:publish
Alternative:
// vite.config.js
import { defineConfig } from 'vite';
import codeigniter from "codeigniter-vite-plugin";
export default defineConfig({
plugins: [
codeigniter([
'resources/css/app.css',
'resources/js/app.js',
]),
],
});
- Install your node dependencies:
npm install
- Start vite server:
npm run dev
- Loading helper
helper('vite')
<!doctype html>
<head>
{{-- ... --}}
<?= vite_tags(['resources/css/app.css', 'resources/js/app.js']) ?>
</head>
Alternative:
<!doctype html>
<head>
{{-- ... --}}
<?= vite_tags('resources/js/app.js') ?>
</head>
The CodeIgniter Vite plugin is open-sourced software licensed under the MIT license.