myth / kindling
A first-class Vite asset pipeline for CodeIgniter 4, with optional Tailwind CSS, Alpine.js, and HTMX support.
Requires
- php: ^8.2
Requires (Dev)
- codeigniter/phpstan-codeigniter: ^1.3
- codeigniter4/devkit: ^1.3
- codeigniter4/framework: ^4.7
- mockery/mockery: ^1.0
- phpstan/phpstan-strict-rules: ^2.0
This package is auto-updated.
Last update: 2026-05-20 22:42:57 UTC
README
A Vite asset pipeline for CodeIgniter 4 — HMR in development, fingerprinted chunk-aware output in production, and zero manual wiring thanks to CI4's auto-discovery.
What you get
- One Spark command —
kindling:installscaffolds your entire asset setup - HMR in development — edit a JS or CSS file and the browser updates instantly, no reload
- Fingerprinted builds in production — Vite hashes every output file; kindling reads the manifest so your views always reference the right URLs
- Shared chunk deduplication — if two entry points share a module, the preload tag is emitted once per request
- Optional integrations — Tailwind CSS v4, Alpine.js, and HTMX v2 all opt-in at install time
- CSP nonce support — pass a nonce to
vite_tags()and it's threaded through every emitted<script>tag
Requirements
- PHP 8.2+
- CodeIgniter 4.7+
- Node.js 18+
Installation
composer require myth/kindling
CI4 discovers the package automatically via Composer — no manual registration needed.
Quick start
Scaffold your asset setup with a single command:
php spark kindling:install
The command asks which entry points you want and whether to include Tailwind, Alpine, or HTMX. Pass flags to skip the prompts:
php spark kindling:install --entry=app --tailwind --alpine --no-htmx
Then install npm dependencies and start the dev server:
npm install npm run dev
Add vite_tags() to your CI4 layout:
<head> <?= vite_tags('app') ?> </head>
That's it. See the Getting Started guide for the full walkthrough.
Optional integrations
Tailwind CSS
Pass --tailwind at install time to include Tailwind CSS v4 via the official Vite plugin. kindling generates a Tailwind-aware vite.config.js and a CSS entry stub with the import already included.
php spark kindling:install --tailwind
Alpine.js
Pass --alpine to include Alpine.js. kindling adds it to package.json and writes the initialization code into your JS entry file.
php spark kindling:install --alpine
HTMX
Pass --htmx to include HTMX v2. Works great alongside michalsn/codeigniter-htmx for CI4-aware HTMX helpers.
php spark kindling:install --htmx
Documentation
Full documentation is at lonnieezell.github.io/kindling.
- Getting Started — working in under 5 minutes
- Vite Fundamentals — new to Vite? Start here
- Configuration — every config option explained
- Using in Views — the
vite_tags()helper and nonce support
Contributing
Pull requests are welcome. The project uses Docker for a consistent dev environment.
composer docker:test # run PHPUnit composer docker:cs-fix # fix coding style composer docker:analyze # PHPStan + Rector composer docker:ci # run all checks composer docker:shell # bash inside the container
License
MIT — see LICENSE.