Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@re-se
Created December 3, 2016 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save re-se/82a2f5d3d1fb814d6247d71ccdf350bc to your computer and use it in GitHub Desktop.
Save re-se/82a2f5d3d1fb814d6247d71ccdf350bc to your computer and use it in GitHub Desktop.
chokidar = require("chokidar")
exec = require('child_process').exec
distPath = process.argv[3]
watcher = chokidar.watch process.argv[2],
ignored:/[\/\\]\./,
persistent:true
watcher.on 'ready', ->
watcher.on 'add', (path) ->
console.log "#{path} added"
watcher.on 'change', (path) ->
console.log "#{path} changed"
exec "qlmanage -t #{path} -s 3000 -o #{distPath}", (err, res) ->
console.log err if err?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment