LiveReload.js is the client-side JavaScript implementation of the LiveReload protocol, designed to automatically refresh web browsers during development when file changes are detected by a compatible LiveReload server. The current stable version is 4.0.2, with releases occurring periodically for bug fixes and dependency updates. Unlike many development tools, this package is explicitly *not* recommended for direct installation or bundling by most end-users; instead, it is intended to be served and managed by a LiveReload server (e.g., LiveReload app for Mac, rack-livereload, guard-livereload, grunt-contrib-watch, python-livereload). This approach ensures compatibility and allows for server-specific customizations. It supports live CSS and image reloading, as well as full page reloads for other file types, communicating with the server via WebSockets. It differentiates itself by being solely the client aspect of a larger ecosystem, expecting a server component to drive its functionality.
npm install livereload-jsVerified import paths — ran on the pinned version, not inferred.
This HTML snippet demonstrates the most common way to include the `livereload.js` client in a web page, typically injected by a LiveReload server, enabling automatic browser reloading on file changes.
Refer to your LiveReload server's documentation for the correct method of client-side integration, which usually involves a simple HTML script tag snippet. Avoid direct `npm install livereload-js` unless you are developing a LiveReload server or have a niche use case.
Ensure that if you are dynamically generating the `livereload.js` script URL and intend for a specific port (or the default 35729), you explicitly include it in the `port` query parameter (e.g., `?port=35729`). If you want it to derive from the page's host, leave the `?port=` parameter entirely, or set it to an empty string for the intended effect.
Ensure `livereload-js` is only executed in a web browser environment. If integrating with build tools like Browserify, be aware that it expects browser globals. For server-side LiveReload functionality, use a Node.js-based LiveReload server package (e.g., `livereload`).
Ensure your build process excludes `livereload.js` from production bundles. When using the HTML script tag injection method, configure your server to only inject it in development environments. Use `npm install --save-dev` or `bower install --save-dev` if installing directly.
This script is designed for browsers. Ensure it's included in an HTML page or a client-side bundle that executes in a browser environment. If you need server-side LiveReload, use a dedicated Node.js LiveReload *server* package.
Verify your LiveReload server is running and listening on the expected port (default 35729). Check the script tag's `src` URL for correct host and port. Ensure no firewalls are blocking connections to the LiveReload port.
Confirm the `<script>` tag loading `livereload.js` is correctly placed and accessible (e.g., `http://localhost:35729/livereload.js`). Check browser developer tools for network errors during script loading. Ensure there are no JavaScript errors preventing its execution.
No dependency data recorded yet.