-
-
Save kahlil/8070147 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'); | |
var gutil = require('gulp-util'); | |
var express = require('express'); | |
var path = require('path'); | |
var tinylr = require('tiny-lr'); | |
var createServers = function(port, lrport) { | |
var lr = tinylr(); | |
lr.listen(lrport, function() { | |
gutil.log('LR Listening on', lrport); | |
}); | |
var app = express(); | |
app.use(express.query()) | |
.use(express.bodyParser()) | |
.use(express.static(path.resolve('./'))) | |
.use(express.directory(path.resolve('./'))) | |
.listen(port, function() { | |
gutil.log('Listening on', port); | |
}); | |
return { | |
lr: lr, | |
app: app | |
}; | |
}; | |
var servers = createServers(8080, 35729); | |
gulp.task('default', function(){ | |
gulp.watch(["./**/*", "!./node_modules/**/*"], function(evt){ | |
gutil.log(gutil.colors.cyan(evt.path), 'changed'); | |
servers.lr.changed({ | |
body: { | |
files: [evt.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": "site", | |
"dependencies": { | |
"tiny-lr": "0.0.5", | |
"gulp": "~3.2.0", | |
"express": "~3.4.7", | |
"gulp-util": "~2.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment