A clean and ready-to-use starter kit to integrate Tailwind CSS with CodeIgniter 3. This kit allows you to quickly set up a CI3 project with Tailwind CSS for modern, responsive UI development.
- Tailwind CSS v3 pre-configured
- PostCSS and Autoprefixer setup
- Watch and build scripts for development and production
- Supports CodeIgniter 3 views (including HMVC modules)
- Dark/light mode ready (optional)
- Compatible with multi-version Node.js using
.nvmrc - Clean and minimal project structure
- Ready to be used as a GitHub template
- Node.js (recommended: use
nvmto manage versions) - CodeIgniter 3 (3.1.x or later)
-
Click "Use this template" to create a new repository from this starter kit.
-
Clone your new repository:
git clone <your-repo-url> cd <your-repo-name>
-
Install dependencies:
npm install
-
Use the correct Node.js version (optional, if using
nvm):nvm use
-
Build Tailwind CSS for the first time:
npm run build
This will generate
assets/css/tailwind.css. -
Link the CSS file in your CI3 view:
<link rel="stylesheet" href="<?php echo base_url('assets/css/tailwind.css'); ?>" />
To watch for changes in src/input.css and rebuild CSS automatically, run:
npm run dev
### Production
To build a minified version of the CSS, run:
```bash
npm run build
```
## 📁 Project Structure
```
project/
├── application/
├── assets/
│ └── css/
│ └── tailwind.css (generated)
├── src/
│ └── input.css (Tailwind directives)
├── package.json
├── tailwind.config.js
├── postcss.config.js
├── .nvmrc
├── .gitignore
└── README.md
```
## 🎨 Customization
- Modify `src/input.css` to add custom base styles or `@layer` directives.
- Edit `tailwind.config.js` to customize theme, add plugins, or modify content paths.
## 📌 Notes
- The `content` paths in `tailwind.config.js` are configured to scan both `application/views` and `application/modules/**/views` for Tailwind classes.
- You can use Tailwind classes directly in your CI3 PHP views.
- The `node_modules` directory is ignored by Git. It will be generated by `npm install`.
## 📜 License
MIT
- Simpan file di atas sebagai
README.mddi root folder proyek kamu. - Commit dan push ke GitHub:
git add README.md
git commit -m "Add complete README.md"
git push origin main