mihatori/codeignitervite

Integrate viteJs in codeiginter4 framework

v2.0.0-beta 2022-08-02 05:24 UTC

This package is auto-updated.

Last update: 2024-05-09 08:36:38 UTC


README

logo.png

Codeigniter + viteJs

Vitejs Integration For Codeigniter4

68747470733a2f2f637573746f6d2d69636f6e2d6261646765732e6865726f6b756170702e636f6d2f6769746875622f762f72656c656173652f6669727461646f6b65692f636f646569676e697465722d766974656a733f6c6f676f3d746167 68747470733a2f2f617765736f6d652e72652f6d656e74696f6e65642d62616467652e737667 68747470733a2f2f637573746f6d2d69636f6e2d6261646765732e6865726f6b756170702e636f6d2f7061636b61676973742f73746172732f6d696861746f72692f636f646569676e69746572766974653f6c6f676f3d73746172 68747470733a2f2f6261646765732e686970746573742e636f6d2f7061636b61676973742f64742f6d696861746f72692f636f646569676e69746572766974653f636f6c6f723d253233633730306666266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d253233633730306666 68747470733a2f2f637573746f6d2d69636f6e2d6261646765732e6865726f6b756170702e636f6d2f7061636b61676973742f6c2f6d696861746f72692f636f646569676e69746572766974653f6c6f676f3d6c6177

Codeigniter vite is a package that aims to integrate vitejs with codeigniter4 in a simple way.

Features:

  • ⏱️ Almost zero configuration
  • 🧩 Easy to install and remove
  • 🔨 Easy to customize
  • ✌️ Support most used frameworks: react, vue, and svlete. (check v2 for SvelteKit support)
  • 🔥 Enjoy hot module replacement (HMR)

Installation:

composer require mihatori/codeignitervite

then from your project root, run:

php spark vite:init --framework <framework>

replace <framework> with vue, react, svelte, or none

or you can just run:

php spark vite:init

our buddy spark will handle the rest for you 🙃

Getting Started:

  • Install your node dependencies: npm install
  • Start vite server: npm run dev
  • Start CI server: php spark serve or access it through your virtual host.
  • That's all =)

NOTE:

npm run dev is not where you should work, it main purpose is to serve assets, such as scripts or stylesheets. once you build your files, it becomes useless but as long as it running, the package will use it instead of the bundled files. So make sure to access your project from ci server or a vitual host.

Build your files:

to bundle your files, run:

npm run build

this command will generate the bundled assets in your public directory. but as we said before, as long as vite server is running, the package will use it instead of bundled files, so make sure to stop it when you're done developing.

Uninitialize:

composer remove mihatori/codeignitervite command will remove the package, but the generated files will remain there (package.json, vite.config.js ...etc). so to avoid that, make sure to run the following command first:

php spark vite:remove

This command will do the following:

  • delete package.json, packages.lock.json and vite.config.js.
  • delete resources folder.
  • And finally restore your .env file.

🔥 Need a quick start?

Check out our starter apps for svelte and vue.

ci-svelte.webp ci-vue.webp

Contributing

All contributions are welcome, it doesn't matter whether you can code, write documentation, or help find bugs. feel free to use issues or pull requests.

Support

Unfortunately, I don't drink coffee 💔, but you can star it instead 🙃

License

MIT License © 2022 Mihatori Kei