-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
46 lines (36 loc) · 1003 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var gulp = require('./gulpfile')
var express = require('express')
var gaze = require('gaze')
var path = require('path')
var tinylr = require('tiny-lr-fork')()
var conf = {
port : 4050
}
/** Livereload */
tinylr.listen(35729)
var livereload = function (evt, filepath) {
tinylr.changed({
body: {
files: path.relative(__dirname, filepath)
}
})
}
/** Initial webpack */
gulp.tasks.build.fn()
/** Server */
var app = express()
.use(express.static(__dirname))
.listen(conf.port, function(){
console.log('Server running at http://localhost:'+conf.port)
})
/** Gaze */
gaze(['src/*.md', 'templates/*.html'], function(err, watcher) {
this.on('all', function(event, filepath) {
gulp.tasks.build.fn()
})
})
gaze(['index.html','blog/*.html','styles/*.css','scripts/*.js'], function(err, watcher) {
watcher.on('all', function(event, filepath) {
livereload(event, filepath)
})
})