Skip to content

Instantly share code, notes, and snippets.

@gld1982ltd
gld1982ltd / combinejs.js
Created January 29, 2016 03:19 — forked from dobesv/combinejs.js
Combine, minify, and compress javascript files. Supports "watching" the files for automatic updates
#!node
var fs = require('fs'),
path = require('path'),
gzip = require('./gzip');
function process(fileBody, options, cb) {
if(typeof(fileBody) === 'object') {
options = fileBody;
fileBody = undefined;
cb = options;
@gld1982ltd
gld1982ltd / gist:d0d7ac835011d1f9bef2
Created January 29, 2016 03:33 — forked from yuanchuan/gist:2586540
Watch a directory recursively
/**
* Watch a directory recursively
*
* @param {String} dir
* @param {Function} cb
*
* watchRecursive('directory', function(current) {
* console.log(current, ' changed');
* });
*/
var fs = require('fs');
var util = require('util');
var writer = fs.createWriteStream('../log.txt');
fs.watch('.', function (event, filename) {
writer.write('================\nEvent: ' + event + '\n');
if (filename) {