-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
83 lines (75 loc) · 2.05 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
73
74
75
76
77
78
79
80
81
82
83
const { all } = require('core-js/fn/promise');
/**
* Build config for Telpirion.com site.
*
* @author Eric Schmidt
* @version 1.0 2018/12/23
* @copyright Eric Schmidt
*/
const gulp = require('gulp'),
dom = require('gulp-dom'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
del = require('del'),
exec = require('child_process').exec;
gulp.task('pre', () => {
return del(['ng/*']);
});
gulp.task('ng-build', (cb) => {
exec('ng build --configuration production', (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('yahtzy', () => {
return gulp.src([
'gsrc/yahtzy/src/game.js',
'gsrc/yahtzy/src/robot.js',
'gsrc/yahtzy/src/ui-controllers.js',
'gsrc/yahtzy/src/utilities.js',
'gsrc/yahtzy/src/main.js'
])
.pipe(concat('yahtzy.js'))
.pipe(uglify().on('error', (e) => {
console.log(e);
}))
.pipe(gulp.dest('games/yahtzy'));
});
gulp.task('conway', () => {
return gulp.src([
'gsrc/conway/src/game.js',
'gsrc/conway/src/ui.js',
'gsrc/conway/src/main.js'
])
.pipe(concat('conway.js'))
.pipe(uglify().on('error', (e) => {
console.log(e);
}))
.pipe(gulp.dest('games/conway'));
});
gulp.task('vikings', () => {
return gulp.src([
'gsrc/vikings/src/animation.js',
'gsrc/vikings/src/physics.js',
'gsrc/vikings/src/page.js',
'gsrc/vikings/src/main.js'
])
.pipe(concat('vikings.js'))
.pipe(uglify().on('error', (e) => {
console.log(e);
}))
.pipe(gulp.dest('games/vikings'));
});
gulp.task('post', () => {
return gulp.src('./ng/index.html')
.pipe(dom(function () {
return this.querySelectorAll('script')
.forEach(script => {
script.setAttribute('defer', 'true');
});
}))
.pipe(gulp.dest('./ng/'));
});
gulp.task('build',
gulp.series('pre', 'ng-build', 'yahtzy', 'conway', 'vikings', 'post'));