Skip to content

Instantly share code, notes, and snippets.

@robcalcroft
Created March 24, 2018 20:01
Show Gist options
  • Save robcalcroft/1802b1a64504544e5423a1dc74e6eee4 to your computer and use it in GitHub Desktop.
Save robcalcroft/1802b1a64504544e5423a1dc74e6eee4 to your computer and use it in GitHub Desktop.
Super simple build tool for watching and running static builds - watches recursively unlike some watching tools out there
const fs = require('fs');
const build = () => {
console.info('Building');
// Run your build here
};
const watchAndBuild = () => {
console.info('Watching files for rebuild');
fs.watch('src', { recursive: true }, build);
};
if (process.argv[2] === 'watch') watchAndBuild();
else build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment