/laravel-mix-blade-reload

Laravel Mix extension to auto-reload browser when you change the blade views.

Primary LanguageTypeScriptMIT LicenseMIT

Laravel Mix Blade Reload

Laravel Mix extension to auto-reload browser when you change the blade views.

Installation

Install the extension:

npm install laravel-mix-blade-reload

Or if you prefer yarn:

yarn add laravel-mix-blade-reload

Next require the extension inside your Laravel Mix config and call bladeReload() in your pipeline:

// webpack.mix.js
const mix = require('laravel-mix');
require('laravel-mix-blade-reload');

mix.js('resources/js/app.js', 'public/js')
    .bladeReload();

Note

Works only when running HMR - Hot Module Replacement script (npm run hot).

Options

Default options

If nothing is passed to the extension inside your Laravel Mix config, the following options will be used:

{
    path: 'resources/views/**/*.blade.php',
    debug: false
}

Option details

  • path (string or array of strings). Path to files, directories to be watched recursively, or glob patterns.
  • debug (boolean). Whenever to log extension event messages to the console.

Changelog

New in version 2.x

  • Now supports laravel-mix version 6

New in version 1.x

  • Rewrited into TypeScript
  • Option paths was renamed to path