-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
74 lines (62 loc) · 1.66 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var ts = require('gulp-typescript');
var webserver = require('gulp-webserver');
var gulp = require('gulp');
var sass = require('gulp-sass');
var shell = require('gulp-shell');
var jasmine = require('gulp-jasmine-phantom');
var KarmaServer = require('karma').Server;
gulp.task('sass', function () {
gulp.src('app/sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'));
});
gulp.task('sassw', function(){
gulp.watch('app/sass/**/*.scss', gulp.series("sass"));
});
gulp.task('compress', function() {
return gulp.src('build/**/*.js')
.pipe(uglify())
.pipe(gulp.dest('build'));
});
var tsProject = ts.createProject('tsconfig.json');
gulp.task('tsc', function () {
var tsResult = tsProject.src()
.pipe(ts(tsProject));
return tsResult.js.pipe(gulp.dest('app/js'));
});
gulp.task('lite', shell.task([
'lite-server'
]));
gulp.task('tscw', function () {
gulp.watch('app/**/*.ts', gulp.series('tsc'));
});
gulp.task('server', function(){
gulp.src('./', '!/**/*.ts')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: 'index.html'
}));
});
gulp.task('develop',
gulp.series('tsc',
gulp.parallel('server','tscw', 'sassw')
)
);
gulp.task('build',
gulp.series('tsc','compress')
);
gulp.task('test', function (done) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('testw', function (done) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
autoWatch: true
}, done).start();
});