Learn Laravel and Vite
Laravel provides seamless integration with Vite, a next generation front-end bundler that is lightning fast. In this miniseries, join me as I outline Laravel's Vite integration in a way that's easy to understand. You'll be bundling your client-side assets in no time!
Progress
Series Info
- Episodes
- 8
- Run Time
- 57m
- Difficulty
- Intermediate
- Last Updated
- May 22, 2024
- Version
- Latest
Series Episodes
- Laravel's Vite Integration (8)
Getting Started with Vite
Vite is included with every Laravel project. So, let's create a project and look at how to set up Vite.Processing Static Assets
If it's a client-side asset, Vite can process it. In this episode, you'll learn how to configure Vite to process static assets and use Laravel's Vite::asset() method to generate URLs for them.Using Aliases
Aliases allow you to simplify the paths to your modules or assets. Instead of writing out the full path every time you import a module or asset, you can use a shorter, more intuitive alias. Let's look at how to create them.Installing Vue and Using Environment Variables
Chances are good that you will use a framework like Vue. In this episode, we'll install and configure Vue for our project. You'll also learn how to create and use environment variables with Vite.Installing React
Vue isn't your cup o' tea? Then let's look at how to install and configure React in a project. But seriously, use a preset.Applying Attributes to Elements
Laravel and Vite generate the <script> and tags that it needs to resolve our assets, but what if you need to apply attribues to those tags? You can! I'll show you how to use the Vite facade to do so.Testing with Vite
Laravel's integration with Vite requires that your tests be able to resolve assets. I'll show you three ways you can handle Vite-processed assets for your tests.Customizing Laravel's Vite Plugin
Out of the box, Laravel's Vite plugin uses settings that are just fine for most applications, but you may want to change Vite's behavior for some applications. I'll show you how you can do that.
