-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
54 lines (46 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 tsc = require('gulp-typescript');
var tslint = require('gulp-tslint');
var sourcemaps = require('gulp-sourcemaps');
var tsProject = tsc.createProject('tsconfig.json');
var config = require('./gulp.config')();
var browserSync = require('browser-sync');
var superstatic = require('superstatic');
gulp.task('ts-lint', function() {
return gulp.src(config.allTs)
.pipe(tslint())
.pipe(tslint.report('prose', {
emitError: false
}))
});
gulp.task('compile-ts', function(){
var sourceTsFiles = [
config.allTs,
config.typings
];
var tsResult = gulp
.src(sourceTsFiles)
.pipe(sourcemaps.init())
.pipe(tsc(tsProject));
return tsResult.js
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(config.tsOutputPath));
});
gulp.task('serve', ['ts-lint', 'compile-ts'], function(){
//watch for changes... if a change: lint, recompile
gulp.watch([config.allTs], ['ts-lint', 'compile-ts']);
browserSync({
port: process.env.PORT,
file: ['index.html', '**/*.js'],
injectChanges: true,
logFileChanges: false,
logLevel: 'silent',
notify: true,
reloadDelay: 0,
server: {
baseDir: './app',
middleware: superstatic({debug: false})
}
});
});
gulp.task('default', ['serve']);