-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
63 lines (51 loc) · 1.79 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
51
52
53
54
55
56
57
58
59
60
61
62
63
"use strict";
import gulp from 'gulp';
import rename from 'gulp-rename';
import server from 'gulp-express';
import rimraf from 'rimraf';
import browserify from 'browserify';
import uglifyify from 'uglifyify';
import glob from 'glob';
import source from 'vinyl-source-stream';
gulp.task('clean', (cb) => {
rimraf('./build', cb);
});
gulp.task('build:js:github', () => {
let files = glob.sync('./src/github/**/*.js');
return browserify({entries: files})
.transform("babelify", {presets: ["es2015"]})
.transform('uglifyify')
.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('./build/github'));
});
gulp.task('build:schema:github', () => {
return gulp.src('src/github/**/*.json')
.pipe(rename({dirname: ''}))
.pipe(gulp.dest('./build/github/schema'));
});
gulp.task('build:assets:github', () => {
return gulp.src('src/github/assets/**/*')
.pipe(rename({dirname: ''}))
.pipe(gulp.dest('./build/github/assets'));
});
gulp.task('build:css:github', () => {
return gulp.src('src/github/**/*.css')
.pipe(rename({dirname: ''}))
.pipe(gulp.dest('./build/github'));
});
gulp.task('build:html:github', () => {
return gulp.src('src/github/**/*.html')
.pipe(rename({dirname: ''}))
.pipe(gulp.dest('./build/github'));
});
gulp.task('build:github', gulp.parallel('build:js:github', 'build:schema:github', 'build:css:github', 'build:assets:github', 'build:html:github'));
gulp.task('build', gulp.parallel('build:github'));
gulp.task('connect:server', function () {
server.run(['app.js']);
// Restart the server on file changes.
gulp.watch(['src/github/index.html'], server.notify);
gulp.watch(['src/**/*.js'], gulp.series('build', server.run));
gulp.watch(['app.js'], server.run);
});
gulp.task('default', gulp.series('clean', 'build', 'connect:server'));