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

connect-livereload

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-livereload

connect middleware for adding the livereload script to the response

  • 0.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
332K
increased by7.13%
Maintainers
1
Weekly downloads
 
Created

What is connect-livereload?

The `connect-livereload` npm package is a middleware for Connect and Express that injects a script into your HTML to enable live reloading. This is particularly useful during development as it allows for automatic reloading of the web page when changes are detected, improving the development workflow.

What are connect-livereload's main functionalities?

Automatic Script Injection

This feature automatically injects the livereload script into your HTML, enabling live reloading of the page when changes are detected. The code sample demonstrates how to set up an Express server with the `connect-livereload` middleware.

const connectLivereload = require('connect-livereload');
const express = require('express');
const app = express();

app.use(connectLivereload());

app.get('/', (req, res) => {
  res.send('<html><body><h1>Hello World</h1></body></html>');
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Custom Script Injection

This feature allows you to specify a custom URL for the livereload script. The code sample shows how to configure the middleware to use a custom script URL.

const connectLivereload = require('connect-livereload');
const express = require('express');
const app = express();

app.use(connectLivereload({
  src: 'http://localhost:35729/livereload.js?snipver=1'
}));

app.get('/', (req, res) => {
  res.send('<html><body><h1>Hello World</h1></body></html>');
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Other packages similar to connect-livereload

Keywords

FAQs

Package last updated on 12 Sep 2016

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