-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.babel.js
50 lines (43 loc) · 1.27 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import sass from 'gulp-sass';
import ts from 'gulp-typescript';
import tslint from 'gulp-tslint';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
import fs from 'file-system';
import yaml from 'js-yaml';
const config = yaml.safeLoad(fs.readFileSync('gulpfile.config.yml', 'utf8'));
const tsProject = ts.createProject('tsconfig.json');
gulp.task('sass', () => {
return gulp.src('src/client/styles/style.scss')
.pipe(sass({
outputStyle: 'compressed'
}))
.pipe(gulp.dest('src/client/styles'));
});
gulp.task('tslint', () => {
return gulp.src(['src/client/app/**/*.ts'])
.pipe(tslint({
formatter: 'verbose'
}))
.pipe(tslint.report())
});
gulp.task('ts', ['tslint'], () => {
let tsResult = gulp.src(config.tsFiles)
.pipe(tsProject());
return tsResult.js.pipe(gulp.dest('src/client/app'));
});
gulp.task('bundle', ['ts'], () => {
browserify({
entries: config.bundleFiles
})
.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('src/client/app'));
});
gulp.task('watch', () => {
gulp.watch('src/client/styles/*.scss', ['sass']);
gulp.watch('src/client/app/**/*.ts', ['tslint']);
});
gulp.task('build', ['sass', 'bundle']);
gulp.task('default', ['build', 'watch']);