Download the PHP package yassinedoghri/codeigniter-vite without Composer
On this page you can find all versions of the php package yassinedoghri/codeigniter-vite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yassinedoghri/codeigniter-vite
More information about yassinedoghri/codeigniter-vite
Files in yassinedoghri/codeigniter-vite
Package codeigniter-vite
Short Description A simple ViteJS integration for CodeIgniter4 projects.
License MIT
Informations about the package codeigniter-vite
CodeIgniter Vite
An opinionated Vite integration for CodeIgniter4 projects.
Easily manage and bundle JavaScript, TypeScript and CSS files with a Resources
folder in your CodeIgniter app:
- 🚀 Getting started
- 0. Prerequisites
- 1. Setup
- 2. Run the dev environment
- 3. Bundle for production
- ⚙️ Config reference
- Routes/Assets mapping
- Environment Variables
- ❤️ Acknowledgments
- 📜 License
🚀 Getting started
0. Prerequisites
-
Install Node.js* with one of the following package managers:
npm
(should be included with Node install)pnpm
(recommended),yarn
- create a
package.json
file:
*You may want to use Deno or Bun instead.
1. Setup
-
install
codeigniter-vite
using composer: -
install Vite with
@rollup/plugin-multi-entry
: -
copy the following
vite.config.js
file in the root of your CodeIgniter project: -
Add Vite's scripts to your
package.json
: -
Create the
Resources
folder in your CodeIgniter app folder: -
Edit your
app/Config/Vite.php
config file to inject your styles and scripts in your routes: - That's all! Your assets will get automatically linked in the
<head>
of your routes depending on the mapping you define.
2. Run the dev environment
Run Vite's dev server with:
By default, the server will launch @http://localhost:5173. See the config reference to change the host or port.
3. Bundle for production
For production, run the build command:
This will create an assets
folder in your public directory including all of
your bundled css and js files + a manifest.json
file under a .vite/
directory.
⚙️ Config reference
Routes/Assets mapping
For assets to be injected in your routes <head>
, you must define the
$routesAssets
property in your app/Config/Vite.php
file.
The $routesAssets
property takes in an array of routes/assets mappings:
Environment Variables
You can tweak the following environment variables to your liking:
Note that you can use the *
wildcard to match any other applicable characters
in the routes.
❤️ Acknowledgments
This wouldn't have been possible without the amazing work of the CodeIgniter team.
Inspired by codeigniter-vitejs.
📜 License
Code released under the MIT License.
Copyright (c) 2025-present, Yassine Doghri (@yassinedoghri).