-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
113 lines (94 loc) · 2.95 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
var gulp = require('gulp');
var run = require('gulp-run');
var gutil = require('gulp-util');
var clean = require('gulp-clean');
var wiredep = require('wiredep');
var merge = require('merge-stream');
var livereload = require('gulp-livereload');
var electron = require('gulp-electron');
var packageJson = require('./src/package.json');
var winInstaller = require('electron-windows-installer');
var $ = require('gulp-load-plugins')();
var BASE_DIR = './src/',
SRC_DIR = BASE_DIR + 'src/',
SASS_DIR = SRC_DIR + 'scss/',
JS_DIR = SRC_DIR + 'js/',
FONT_DIR = SRC_DIR + 'iconfont/',
OUT_DIR = BASE_DIR + '',
CSS_OUT = OUT_DIR + 'css/',
JS_OUT = OUT_DIR + 'js/';
FONT_OUT = OUT_DIR + 'img/fonts/';
gulp.task('exe', function(done) {
//gulp.src('./release').pipe(clean({force: true}))
winInstaller({
appDirectory: './build/v1.3.1/win32-ia32',
outputDirectory: './release',
arch: 'ia32',
authors: 'Marvin Kerkhoff',
noMsi: false,
version: "0.2.1",
setupExe: 'Midgard-Setup.exe',
iconUrl: 'http://midgard-online.de/favicon-midgard-online.ico'
}).then(done).catch(done);
});
gulp.task('build', function() {
//gulp.src('./build').pipe(clean({force: true}))
gulp.src("")
.pipe(electron({
src: './src',
packageJson: packageJson,
release: './build',
cache: './cache',
version: 'v1.3.1',
packaging: true,
platforms: ['win32-ia32'],
platformResources: {
win: {
"version-string": packageJson.version,
"file-version": packageJson.version,
"product-version": packageJson.version,
"icon": 'http://midgard-online.de/favicon-midgard-online.ico'
}
}
}))
.pipe(gulp.dest(""));
});
gulp.task('styles', function () {
var styles = gulp.src(SASS_DIR + '*.scss')
//.pipe($.sourcemaps.init())
.pipe($.sass({
outputStyle: 'expanded',
precision: 10,
includePaths: ['.'],
onError: console.error.bind(console, 'Sass error:'),
}))
.pipe($.postcss([
require('autoprefixer-core')({browsers: ['last 3 version','IE >= 8']})
]))
//.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest(CSS_OUT))
.pipe(livereload());
return merge(styles);
});
gulp.task('watch', ['styles', 'scripts', 'bower'], function () {
livereload.listen();
gulp.watch(SASS_DIR + '**/*.scss', ['styles']);
gulp.watch(JS_DIR + '**/*.js', ['scripts']);
gulp.watch('./bower.json', ['bower']);
});
gulp.task('scripts', function(){
var widgets = gulp.src(JS_DIR + 'widgets/*.js')
var main = gulp.src(JS_DIR + '*.js')
return merge(widgets, main).pipe($.concat('all.js')).pipe(gulp.dest(JS_OUT));;
});
gulp.task('bower', function(){
var files = wiredep();
return gulp.src(files.js)
.pipe($.concat('vendor.js'))
.pipe($.uglify())
.pipe(gulp.dest(JS_OUT));
});
gulp.task('run', ['styles', 'scripts'], function() {
return run('electron ./src').exec();
});
gulp.task('default', ['watch', 'run']);