Last active
August 29, 2015 13:57
-
-
Save marr/9802975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), livereload = require('gulp-livereload'), | |
gutil = require('gulp-util'), | |
dest = 'build'; | |
gulp.task('staticsvr', function(next) { | |
var staticS = require('node-static'), | |
server = new staticS.Server('./' + dest), | |
port = 8000; | |
require('http').createServer(function (request, response) { | |
request.addListener('end', function () { | |
server.serve(request, response); | |
}).resume(); | |
}).listen(port, function() { | |
gutil.log('Server listening on port: ' + gutil.colors.magenta(port)); | |
next(); | |
}); | |
}); | |
gulp.task('watch', ['staticsvr'], function() { | |
var server = livereload(); | |
gulp.watch(dest + '/**').on('change', function(file) { | |
server.changed(file.path); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "gulpsrv", | |
"version": "0.0.0", | |
"description": "", | |
"main": "gulpfile.js", | |
"dependencies": { | |
"gulp": "~3.5.6", | |
"gulp-livereload": "~1.2.0", | |
"gulp-util": "~2.2.14", | |
"node-static": "~0.7.3" | |
}, | |
"devDependencies": {}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "https://gist.github.com/koistya/574822628b372f8004bd.git" | |
}, | |
"author": "", | |
"license": "BSD-2-Clause", | |
"bugs": { | |
"url": "https://gist.github.com/koistya/574822628b372f8004bd" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment