-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (29 loc) · 829 Bytes
/
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
var gulp = require('gulp');
var PATHS = {
src: ['src/**/*.ts','index.html']
};
var connect = require('gulp-connect');
gulp.task('clean', function (done) {
var del = require('del');
del(['dist'], done);
});
gulp.task('ts2js', function () {
var typescript = require('gulp-typescript');
var tscConfig = require('./tsconfig.json');
var tsResult = gulp
.src(PATHS.src)
.pipe(typescript(tscConfig.compilerOptions));
return tsResult.js.pipe(gulp.dest('dist'));
});
gulp.task('recompile', ['ts2js'], function () {
return gulp.src('.').pipe(connect.reload());
});
gulp.task('play', ['ts2js'], function () {
connect.server({
root: ['.'],
port: 9000,
livereload: true
});
gulp.watch(PATHS.src, ['recompile']);
});
gulp.task('default', ['play']);