Skip to content

CodeIgniter plugin for Vite. Based on Laravel's Vite Plugin.

License

Notifications You must be signed in to change notification settings

monster010/codeigniter-vite-plugin

Repository files navigation

CodeIgniter Vite Plugin

Build Status Total Downloads Latest Stable Version License

Introduction

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.

Installation

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',
        ]),
    ],
});

Getting Started

  • Install your node dependencies: npm install
  • Start vite server: npm run dev
  • Loading helper helper('vite')

Loading Your Scripts and Styles

<!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>

License

The CodeIgniter Vite plugin is open-sourced software licensed under the MIT license.