forked from CelestinaDragoni/open-joystick-display
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (46 loc) · 1.15 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
var gulp = require('gulp');
var watch = require('node-watch');
var less = require('gulp-less');
var combiner = require('stream-combiner2');
var os = require('os');
let cleanCSS = require('gulp-clean-css');
var execSync = require('child_process').execSync;
let fs = require('fs');
function taskError(e) {
console.error(e);
}
function taskCSS(){
return combiner.obj([
gulp.src('./app/stylesheets/less/main.less'),
less(),
cleanCSS(),
gulp.dest('./app/stylesheets')
]).on('error', console.error.bind(console));
}
function taskWatch() {
watch('./app/stylesheets/less', { recursive: true }, function(evt, name) {
console.log(`Updated: ${name}`);
taskCSS()
});
}
function taskRebuildElectron() {
let cmd = '';
if (os.platform() === 'win32') {
cmd = '.\\node_modules\\.bin\\electron-rebuild -p -t "dev,prod,optional"';
} else {
cmd = './node_modules/.bin/electron-rebuild -p -t "dev,prod,optional"';
}
execSync(cmd, {stdio: 'inherit'});
}
gulp.task('default', function(cb) {
taskWatch();
cb();
});
gulp.task('build', function(cb) {
taskCSS();
cb();
});
gulp.task('rebuild-electron', function(cb) {
taskRebuildElectron();
cb();
});