forked from butterproject/butter-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (60 loc) · 2.13 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
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var runSequence = require('run-sequence');
var NwBuilder = require('nw-builder');
var argv = require('yargs')
.alias('p', 'platforms')
.argv;
var del = require('del');
var detectCurrentPlatform = require('nw-builder/lib/detectCurrentPlatform.js');
var nw = new NwBuilder({
files: ['./src/**', '!./src/app/styl/**',
'./node_modules/**', '!./node_modules/bower/**',
'!./node_modules/*grunt*/**', '!./node_modules/stylus/**',
'!./node_modules/nw-gyp/**', '!./node_modules/**/*.bin',
'!./node_modules/**/*.c', '!./node_modules/**/*.h',
'!./node_modules/**/Makefile', '!./node_modules/**/*.h',
'!./**/test*/**', '!./**/doc*/**', '!./**/example*/**',
'!./**/demo*/**', '!./**/bin/**', '!./**/build/**', '!./**/.*/**',
'./package.json', './README.md', './CHANGELOG.md', './LICENSE.txt',
'./.git.json'
],
version: '0.12.2',
build_dir: './build', // Where the build version of my nwjs app is saved
zip: false,
macIcns: './src/app/images/popcorntime.icns', // Path to the Mac icon file
downloadUrl: 'https://get.popcorntime.sh/repo/nw/',
platforms: argv.p ? argv.p.split(',') : [detectCurrentPlatform()]
}).on('log', console.log);
gulp.task('nw:run', function () {
nw.options.files = './**';
return nw.run().catch(function (error) {
console.error(error);
});
});
gulp.task('nw:build', function () {
return nw.build().catch(function (error) {
console.error(error);
});
});
gulp.task('clean:build', function () {
return del('build/');
});
gulp.task('clean:css', function () {
return del('src/app/themes/');
});
gulp.task('css', function () {
var nib = require('nib');
return gulp.src('src/app/styl/*.styl')
.pipe(stylus({
use: nib()
}))
.pipe(gulp.dest('src/app/themes/'));
});
gulp.task('clean', ['clean:build', 'clean:css']);
gulp.task('build', function (callback) {
runSequence('clean', 'css', 'nw:build', callback);
});
gulp.task('start', function (callback) {
runSequence('css', 'nw:run', callback);
});