This repository was archived by the owner on Oct 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
52 lines (44 loc) · 1.23 KB
/
Copy pathGulpfile.js
File metadata and controls
52 lines (44 loc) · 1.23 KB
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
const gulp = require('gulp');
const terser = require('gulp-terser');
const cleanCSS = require('gulp-clean-css');
const htmlmin = require('gulp-htmlmin');
const clean = require('gulp-clean');
const { exec } = require('child_process');
gulp.task('copy', () => {
gulp.src('app/src/img/icons/**/*').pipe(gulp.dest('build'));
gulp.src('app/src/img/icons/icon.png').pipe(gulp.dest('build/src/img/icons/'))
return gulp.src('app/lib/**/*').pipe(gulp.dest('build/lib'));
});
gulp.task('minify-js', () => {
gulp
.src('app/src/**/*.js')
.pipe(terser())
.pipe(gulp.dest('build/src'));
return gulp
.src('app/main.js')
.pipe(terser())
.pipe(gulp.dest('build'));
});
gulp.task('minify-css', () => {
return gulp
.src('app/src/**/*.css')
.pipe(cleanCSS())
.pipe(gulp.dest('build/src'));
});
gulp.task('minify-html', () => {
return gulp
.src('app/src/index.html')
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest('build/src'));
});
gulp.task('build', cb => {
return exec('electron-builder', (error, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(error);
});
});
gulp.task(
'compile',
gulp.series('copy', 'minify-js', 'minify-css', 'minify-html', 'build')
);