-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (33 loc) · 1.23 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
var config = require('./gulp-config.json');
var gulp = require('gulp');
var ts = require('gulp-typescript');
var merge = require('merge2');
var browserSync = require('browser-sync').create();
var tsProject = ts.createProject('tsconfig.json');
var tsd = require('gulp-tsd');
gulp.task('tsd', tsd_task);
gulp.task('build', build_task);
gulp.task('dev',['tsd','build'], dev_task);
function tsd_task(callback) { tsd(config.tsd, callback); }
function dev_task() {
browserSync.init({
server: {
baseDir: config.build.path,
routes: config.build.routes
}
});
gulp.watch(config.src.files.all).on('change', function() {
build_task();
browserSync.reload();
});
}
function build_task() {
var tsResult = gulp.src( config.src.files.ts ).pipe(ts(tsProject));
var other = gulp.src( config.src.files.other );
return merge([ // Merge the two output streams, so this task is finished when the IO of both operations are done.
tsResult.dts.pipe(gulp.dest( config.build.path)),
tsResult.js.pipe(gulp.dest( config.build.path)),
other.pipe(gulp.dest( config.build.path)),
gulp.src( 'config.js').pipe(gulp.dest( config.build.path))
]);
}