-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
52 lines (45 loc) · 1.17 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var connect = require('gulp-connect');
var paths = {
css: ['./client/app/css/**/*.css'],
js: ['./client/app//js/**/*.js'],
html: ['./client/app/index.html', './www/templates/**/*.html']
};
gulp.task('js', function(done) {
gulp.src(paths.js)
.pipe(connect.reload())
.on('end', done);
});
gulp.task('css', function(done) {
gulp.src(paths.css)
.pipe(connect.reload())
.on('end', done);
});
gulp.task('html', function(done) {
gulp.src(paths.html)
.pipe(connect.reload())
.on('end', done);
});
gulp.task('watch', function() {
gulp.watch(paths.js, ['js']);
gulp.watch(paths.css, ['css']);
gulp.watch(paths.html, ['html']);
});
gulp.task('default', ['watch', 'server']);
gulp.task('server', function(){
connect.server({
root: ['client/app'],
port: 9000,
livereload: true,
middleware: function(connect, o) {
return [ (function() {
var url = require('url');
var proxy = require('proxy-middleware');
var options = url.parse('http://0.0.0.0:3000/api');
options.route = '/api';
return proxy(options);
})() ];
}
});
});