Skip to content

Instantly share code, notes, and snippets.

@ajmalafif
Forked from johanhalse/gist:9049840
Created February 17, 2014 13:37
Show Gist options
  • Save ajmalafif/9050597 to your computer and use it in GitHub Desktop.
Save ajmalafif/9050597 to your computer and use it in GitHub Desktop.
// Wrapper for Harp web server, to include JS concat/compile step. Put your stuff
// in /harp subdirectory, npm install your dependencies, run, enjoy.
// Live updating of the concatenated JS file left as an exercise for the reader :)
var fs = require('fs');
var path = require('path');
var harp = require('harp');
var UglifyJS = require('uglify-js');
var files = [];
files.push(__dirname + '/harp/js/file0.js');
files.push(__dirname + '/harp/js/file1.js');
fs.writeFile(__dirname + '/harp/js/main.min.js', UglifyJS.minify( files ).code, 'utf8', function(err) {
if(err) {
console.log(err);
}
else {
harp.server(__dirname + '/harp', {
port: 9000
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment