-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
57 lines (46 loc) · 1.24 KB
/
gulpfile.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
47
48
49
50
51
52
53
54
55
56
57
'use strict';
var gulp = require('gulp');
var livereload = require('gulp-livereload');
var server = require( 'gulp-develop-server' );
var serverFiles = [
'./app.js'
];
gulp.task('default', ['server:start', 'js:watch', 'css:watch', 'html:watch'], function(){
function restart( file ) {
server.changed( function( error ) {
if( ! error ) livereload.changed( file.path );
});
}
gulp.watch( serverFiles ).on( 'change', restart );
});
gulp.task('server', ['default']);
gulp.task( 'server:start', function() {
server.listen( { path: './app.js' }, function(err){
if(err){return;}
livereload.listen;
});
});
gulp.task('html', function() {
gulp.src('./public/*.html')
.pipe(livereload());
});
gulp.task('html:watch', function () {
livereload.listen();
gulp.watch('./public/*.html', ['html']);
});
gulp.task('css', function() {
gulp.src('./public/css/**/*.css')
.pipe(livereload());
});
gulp.task('css:watch', function () {
livereload.listen();
gulp.watch('./public/css/**/*.css', ['css']);
});
gulp.task('js', function() {
gulp.src('./public/js/**/*.js')
.pipe(livereload());
});
gulp.task('js:watch', function () {
livereload.listen();
gulp.watch('./public/js/**/*.js', ['js']);
});