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

express-static-livereload

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-static-livereload

a express middleware to livereload static files

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

express-static-livereload npm package

a express middleware to livereload static files

Installation

$ npm install express-static-livereload  --save-dev

Usage

var express = require('express');
var app = express();
var server = require('http').Server(app);

if (app.get('env') === 'development') {
    var reload = require('express-static-livereload');
    app.use(reload({
        server: server,
        path: 'public'
    }));
}

server.listen(3000);

Example

Options

var defaluts = {
    path: 'public',
    match: /<body[^>]*>/i,
    filter: function(filename) {
        return !/node_modules/.test(filename);
    },
    delay: 1000,
    console: false
};

path

type: string/array

监听变化的目录。可以是目录名字符串或者数组。

match

默认匹配body开始标签,将相关脚本插入到body开始标签之后,可以根据情况修改。console:true的时候可以改成插入到head,可以监听到所有js的报错,并发送到server控制台。

filter

过滤不需要监听的文件。默认过滤掉path目录下面node_modules目录下文件。

delay

修改相同文件同步操作的最小时间间隔。默认1000ms

console

是否劫持浏览器console。开启之后会把浏览器的console信息以及错误信息传输到server控制台。如果要在浏览器控制台使用自带的console功能,请使用__console代替。

Keywords

FAQs

Package last updated on 21 Sep 2015

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