This repository has been archived by the owner on Apr 21, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
61 lines (44 loc) · 1.44 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
const { series, parallel, src, dest, watch } = require('gulp');
const stylus = require('gulp-stylus');
const concat = require('gulp-concat');
const runElectron = require('gulp-run-electron');
const notify = require('gulp-notify');
const plumber = require('gulp-plumber');
const sourcemaps = require('gulp-sourcemaps');
// const debug = require('gulp-debug');
// const minifyCSS = require('gulp-csso');
function js () {
return src('src/**/*.js')
.pipe(plumber({errorHandler: notify.onError('JS: <%= error.message %>')}))
.pipe(dest('app/'));
}
function css () {
return src('src/**/*.styl')
.pipe(sourcemaps.init())
.pipe(plumber({errorHandler: notify.onError('Stylus: <%= error.message %>')}))
.pipe(stylus({ include: __dirname + '/src'}))
.pipe(concat('app.css'))
.pipe(sourcemaps.write())
.pipe(dest('app/'));
}
function webviewCss () {
return src('src/**/webview.css').pipe(dest('app/'));
}
// function previewHtml () {
// return src('src/preview/index.html').pipe(dest('app/preview/'));
// }
function electron () {
return src('./').pipe(runElectron());
}
// build
function watchTask () {
watch('src/**/webview.css', webviewCss);
watch('src/**/*.styl', css);
watch('src/**/*.js', js);
}
const defaultTask = parallel(js, css, webviewCss, /*previewHtml*/);
exports.js = js;
exports.css = css;
exports.dev = series(defaultTask, parallel(electron, watchTask));
exports.watch = series(defaultTask, watchTask);
exports.default = defaultTask;