-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
39 lines (29 loc) · 903 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
var gulp = require('gulp');
var PATHS = {
src: 'src/**/*.ts'
};
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('play', ['ts2js'], function () {
var http = require('http');
var connect = require('connect');
var serveStatic = require('serve-static');
var open = require('open');
var port = 9000, app;
gulp.watch(PATHS.src, ['ts2js']);
app = connect().use(serveStatic(__dirname));
http.createServer(app).listen(port, function () {
open('http://localhost:' + port);
});
});
gulp.task('default', ['play']);