Introduction
Getting Started
Reload is an experimental package that adds hot reload functionality for Laravel Blade.
#Installation
To install Reload, run the following from the root of your project:
1composer require fortephp/reload --dev
If you want to customize the package config, you may publish it by running:
1php artisan vendor:publish --tag=reload-config
#Vite Setup
Import the plugin from Composer vendor:
1// vite.config.js
2import { defineConfig } from 'vite';
3import laravel from 'laravel-vite-plugin';
4import reload from './vendor/fortephp/reload/resources/js/vite-plugin.js';
5
6export default defineConfig({
7 plugins: [
8 laravel({
9 input: ['resources/js/app.js'],
10 refresh: true,
11 }),
12 reload(),
13 ],
14});
Reload watches resources/views/**/*.blade.php by default.
If your Blade files live elsewhere, add more watch patterns:
1reload({
2 watch: [
3 'resources/views/**/*.blade.php',
4 'packages/**/resources/views/**/*.blade.php'
5 ],
6})
The plugin also injects the Reload runtime into resources/js/app.js and resources/js/app.ts by default. If your app uses different entry files, configure entries:
1reload({
2 entries: ['resources/js/admin.js'],
3})
Available plugin options:
watch: Additional Blade globs to watch.log: Set tofalseto silence Reload logs.
#Configuration
The package config lives at config/reload.php.
enabled:nullby default, which enables Reload automatically in the local environment. Set it totrueorfalseto force the behavior.constructs: Controls which Blade constructs are instrumented. Available flags areelements,components,directives,directive_blocks, andincludes.include_vendor_views: Includes vendor Blade views in instrumentation when set totrue.max_patches_before_reload: The maximum number of incremental patches Reload will attempt before falling back to a full refresh.
#Reporting Issues
When reporting issues, please include all necessary steps to reproduce the issue. Linking to a small repository that contains the setup to reproduce helps a lot. Include any dependencies required to reproduce the bug.
#License
Reload is free software, released under the MIT license.