-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
44 lines (37 loc) · 1.07 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
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var tsify = require('tsify');
var babelify = require('babelify');
var uglify = require('gulp-uglify');
var config = {
publicPath: __dirname + '/app/dist',
app: {
path: __dirname + '/src',
main: 'app.ts',
result: 'app.js'
}
};
gulp.task('compile', function() {
return browserify({
basedir: config.app.path,
extensions: ['.js', '.ts', '.json'],
debug: true
})
.plugin(tsify, {target: 'es6'})
.transform(babelify.configure({
extensions: ['.js', '.ts', '.json'],
presets: ["es2015"]
}))
.add(config.app.path + '/' + config.app.main)
.bundle()
.on('error', function(err) {
console.log(err.toString())
})
.pipe(source(config.app.result))
.pipe(gulp.dest(config.publicPath));
});
gulp.task('watch', function () {
gulp.watch('src/**/*.ts', ['compile']);
});
gulp.task('default', ['watch']);