forked from diverted247/ts_base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (40 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var gulp = require( 'gulp' );
var ts = require( 'gulp-tsc' );
var connect = require( 'gulp-connect' );
var shell = require( 'gulp-shell' );
var uglify = require( 'gulp-uglify' );
var del = require( 'del' );
gulp.task( 'clean' , function( cb ){
del([ './dist' ], cb );
});
gulp.task( 'build' , [ 'clean' ] , function(){
return gulp.src( [ './src/build.d.ts' ] )
.pipe( ts( {
target: 'ES5',
outDir: './dist',
//module: 'amd',
emitError: true,
declaration: false,
removeComments: true
} ) )
.pipe( gulp.dest( './dist' ) );
});
gulp.task( 'minify' , [ 'build' ] , function(){
gulp.src( './dist/**' )
.pipe( uglify() )
.pipe( gulp.dest( './dist/' ) )
});
gulp.task( 'server' , [ 'minify' ] , function () {
connect.server({
port: 8081
})
});
gulp.task( 'watch' , function (){
gulp.watch( 'src/**/*.ts' , [ 'minify' ] )
});
gulp.task( 'browser' , [ 'server' ] , shell.task( [
/^win/.test( require( 'os' ).platform() ) ? 'start http://localhost:8081/' : 'open http://localhost:8081/'
] ) );
gulp.task( 'default' , [ 'browser' ] );
gulp.task( 'dev' , [ 'build' ] );
gulp.task( 'prod' , [ 'minify' ] );