var gulp = require('gulp');
var ts = require('gulp-typescript');
var merge = require('merge2');
var tsProject = ts.createProject({
declaration: true,
noExternalResolve: true,
module:'commonjs',
target: 'es6',
});
gulp.task('scripts', function() {
var tsResult = gulp.src('src/**/*.ts')
.pipe(ts(tsProject));
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('build')),
tsResult.js.pipe(gulp.dest('build'))
]);
});
gulp.task('watch', ['scripts'], function() {
gulp.watch('src/**/*.ts', ['scripts']);
});
|