-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
66 lines (53 loc) · 1.42 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
var gulp = require('gulp'),
//gulp_jspm = require('gulp-jspm'),
connect = require('gulp-connect');
// JSPM
// gulp.task('buildJspmPackage', () => {
// // bundle and minify all js
// return gulp.src('./app/app.js')
// .pipe(gulp_jspm({
// fileName: 'app',
// selfExecutingBundle: false,
// minify: false
// }))
// .pipe(gulp.dest('./dist'));
// });
gulp.task('copyJs', () => {
return gulp
.src('./app/**/*.js')
.pipe(gulp.dest('dist'))
.pipe(connect.reload());
});
gulp.task('watchJs', () => {
gulp.watch(['./app/**/*.js'], ['copyJs']);
});
gulp.task('copyJspmAssets', () => {
return gulp
.src('./jspm_packages/**/*.*')
.pipe(gulp.dest('dist/jspm_packages'));
});
gulp.task('copyConfigJs', () => {
return gulp
.src('config.js')
.pipe(gulp.dest('dist'));
});
// HTML
gulp.task('copyHtmlFiles', () => {
return gulp
.src('./app/**/*.html')
.pipe(gulp.dest('dist'))
.pipe(connect.reload());
});
gulp.task('watchHtml', () => {
gulp.watch(['./app/**/*.html'], ['copyHtmlFiles']);
});
// Serve
gulp.task('serve',['build-dev', 'watchHtml', 'watchJs'],() => {
connect.server({
root: 'dist',
livereload: true
});
});
// Builds
gulp.task('build-dev', ['copyJs', 'copyConfigJs', 'copyJspmAssets', 'copyHtmlFiles']);
gulp.task('default', ['build-dev']);