Mini LiveReload Server

0.1.9 · deprecated · verified Tue Apr 21

mini-lr is a JavaScript package that provides a lightweight LiveReload server implementation. It was originally forked from the `tiny-lr` project to address perceived inactivity and provide support for `npm v3` during a period when `tiny-lr` was not being actively maintained. The package exposes an HTTP server and can be used as Express/Connect middleware, offering a basic REST API to notify the server of file changes, which are then broadcast to connected LiveReload clients. It does not include file watching capabilities itself, requiring external build processes or application logic to trigger change notifications. The current stable version is 0.1.9, though the project is explicitly deprecated, with its author recommending users switch back to the now-active `tiny-lr` package. Therefore, there is no active release cadence planned for `mini-lr`.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates setting up a mini-lr server as Express middleware, serving static files and listening for LiveReload notifications.

const path = require('path');
const express = require('express');
const minilr = require('mini-lr');
const body = require('body-parser');

const port = process.env.LR_PORT || process.env.PORT || 35729;

const app = express();

app
  .use(body.urlencoded({ extended: true }))
  .use(body.json())
  .use(minilr.middleware({ app: app }))
  .use(express.static(path.resolve('./')))
  .listen(port, function() {
    console.log(`LiveReload server listening on port ${port}`);
    console.log('To trigger a reload, run: curl http://localhost:35729/changed?files=index.html');
  });

view raw JSON →