fs-onchange
watch file and folder changes
Last updated 2 years ago by soenkekluth .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fs-onchange 
SYNC missed versions from official npm registry.

fs-onchange

Install

local

npm i --save fs-onchange
yarn add fs-onchange

global

npm i -g fs-onchange
yarn --global add fs-onchange

Usage

fs-onchange installs 3 binaries:

fs-onchange
onchange

Command Line

onchange file.ext npm run build
onchange 'path/**/*.js, path/**/*.scss' execute something
onchange '[file1, file2, file3]' execute something

Node


const watcher = require('fs-onchange');
const path = require('path');

const onChangeSass = (obj) => {
  console.log('onChangeSass ', obj);
};

const onChangeAppSccs = (obj) => {
  console.log('onChangeAppSccs ', obj);
};

const onChangeJS = (obj) => {
  console.log('onChangeJS ', obj);
};

const onChangeHTML = (obj) => {
  console.log('onChangeHTML ', obj);
};

const appScssWatcher = watcher.add(path.resolve(__dirname, 'sass/app/_app.scss'), {}, onChangeAppSccs);

watcher.add(`${path.resolve(__dirname, 'sass')}/**/*.scss`, { ignored: appScssWatcher.src }, onChangeSass);
watcher.add(`${path.resolve(__dirname, 'js')}/**/*.js`, {}, onChangeJS);
watcher.watch();

watcher.add([
  `${path.resolve(__dirname, 'html')}/**/*.html`,
  `${path.resolve(__dirname, 'html5')}/**/*.html`,
], {}, onChangeHTML);

Current Tags

  • 1.1.1                                ...           latest (2 years ago)

3 Versions

  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (10)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |