Git Product home page Git Product logo

laravel-vite's Introduction

Using Vite with Tailwind, Laravel, and Inertia โ€” also known as VITALI stack

Demo

https://laravel-vite-uwusu.ondigitalocean.app/

About

This is a project template showing off how to use Vite 2 (super-fast ESM-based development environment, and production bundler) with Laravel, TailwindCSS and InertiaJS.

Updates

This is a v2 of the template. Here are the changes compared to the last version:

  • Upgraded all the dependencies
  • Added Tailwind support with the latest JIT compiler
  • Added Inertia support with lazy-loaded pages and routes
  • Added examples with <script setup> syntax
  • Added tsconfig.json to support Vetur / Volar plugins for VS Code.
  • Added component autoloading
  • Added auto reloading for Laravel files

Getting started

Development

Using Valet

composer install
npm install
npm run dev

Production

npm run build

To test the production build, change the .env file as follows and refresh the page.

APP_ENV=production

Notes

Incompatible Laravel manifest

Vite's manifest generation is not compatible with Laravel Mix manifest, so by default, it does not work with mix() helper.

To overcome this, this demo project relies on custom manifest parsing. Alternatively, one can use the Vite plugin to support Laravel manifest file https://github.com/ohseesoftware/laravel-vite-manifest.

Inertia implementation

To support <script setup> syntax for Inertia's persistent layouts, the component has to export two script sections. Note that we use layoutName instead of layout since Vite's hot module reloading would conflict with Inertia's API.

<script setup>
// Component code here
</script>

<script>
export default { layoutName: "Narrow" };
</script>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.