-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
72 lines (56 loc) · 1.79 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
/// <binding Build='default' />
var del = require('del'),
gulp = require("gulp"),
ts = require('gulp-typescript'),
watch = require('gulp-watch');
var webproj = "./Angular2AspNetCoreStarter/";
var webroot = webproj + "wwwroot/";
var appsource = webproj + "App/";
var appout = webroot + "app/";
var jspmsource = "./jspm_packages/";
var jspmout = webroot + "jspm_packages/";
var paths = {
webroot: webroot,
src: appsource,
app: appout,
jspm: jspmsource,
jspm_out: jspmout
};
gulp.task('watch', ['watch-typescript', 'watch-html']);
gulp.task('watch-typescript', function(){
gulp.watch(paths.src + '/**/*.ts', ['build-typescript']);
});
gulp.task('clean-typescript', function () {
del([paths.app + '/**/*.ts']);
});
gulp.task('build-typescript', ['clean-typescript'], function () {
var tsProject = ts.createProject('./tsconfig.json');
gulp.src(paths.src + '/**/*.ts')
.pipe(ts(tsProject))
.pipe(gulp.dest(paths.app));
});
gulp.task('watch-html', function () {
gulp.watch(paths.src + '/**/*.html', ['copy-html']);
});
gulp.task('clean-html', function () {
del([paths.app + '/**/*.html']);
});
gulp.task('copy-html', ['clean-html'], function () {
gulp.src(paths.src + '/**/*.html')
.pipe(gulp.dest(paths.app));
});
gulp.task('copy-jspm', ['clean-jspm', 'copy-config'], function() {
gulp.src(paths.jspm + "**/*.{js,css,map}")
.pipe(gulp.dest(paths.jspm_out));
});
gulp.task('clean-jspm', function(){
del([paths.jspm_out + "**/*.*"]);
});
gulp.task('copy-config', ['clean-config'], function(){
gulp.src("./config.js")
.pipe(gulp.dest(paths.webroot));
});
gulp.task('clean-config', function(){
del(paths.webroot + 'config.js');
});
gulp.task('default', ['build-typescript', 'copy-html', 'copy-jspm']);