Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-live-reload

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-live-reload

A simple live reloading plugin for vite.

  • 3.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

vite-plugin-live-reload

A simple live reloading plugin for vite.

Example

I use this configuration when working with Kirby CMS, but it works great with any backend!

Note: by default the paths are relative to Vite's root folder.

// vite.config.js
import liveReload from 'vite-plugin-live-reload'

export default {
  // ...
  plugins: [
    liveReload('../site/(templates|snippets|controllers|models)/**/*.php'),
  ]
}

Usage

Watch one or more paths:

liveReload('my/path/**/*.php')
liveReload(['my/path/**/*.php', 'my/other/path/**/*.php'])

The plugin uses a chokidar watcher. See the chokidar documentation to find out which path notations are supported.

Options

Root

By default Vite's root directory is used, but you can specify your own directory:

liveReload('my-file', { root: process.cwd() })

Always reload

If the modified file is an .html file, Vite's client only reloads the page if the browser is currently on this HTML page. With alwaysReload the browser is reloaded anyway.

liveReload('my-file', { alwaysReload: true })

Keywords

FAQs

Package last updated on 03 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc