-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
112 lines (93 loc) · 2.77 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
var nconf = require('nconf');
var gulp = require('gulp');
var wrench = require('wrench');
var browserSync = require('browser-sync');
var runSequence = require('run-sequence');
//config
var setupConfig = function(env) {
nconf.argv()
.env()
.file({
file: __dirname + '/tasks/config/' + env + '.json'
});
}
//options
var opts = {
nconf: nconf,
browserSync: browserSync.create(),
vendorDir: __dirname + '/src/client/vendor',
nodeModulesDir: __dirname + '/node_modules',
scripts: {
srcFile: __dirname + '/src/client/app/index.js',
buildDir: __dirname + '/build/js',
buildFile: 'app.js',
},
vendor: {
srcFile: [
__dirname + '/src/client/vendor/jquery/dist/jquery.min.js',
__dirname + '/src/client/vendor/bootstrap-sass/assets/javascripts/bootstrap.min.js',
__dirname + '/src/client/vendor/wavesurfer.js/dist/wavesurfer.min.js',
__dirname + '/src/client/vendor/wavesurfer.js/dist/plugin/wavesurfer.regions.min.js',
__dirname + '/src/client/vendor/timbre.js/timbre.dev.js',
__dirname + '/src/client/vendor/timbre.js/src/extras/jsmad.js',
__dirname + '/src/client/vendor/timbre.js/src/extras/mp3_decode.js'
],
buildDir: __dirname + '/build/js',
buildFile: 'vendor.js'
},
styles: {
srcFile: __dirname + '/src/client/assets/scss/screen.scss',
buildDir: __dirname + '/build/css',
buildFile: 'screen.css'
},
fonts: {
srcDir: __dirname + '/src/client/vendor/font-awesome/fonts/**/*',
buildDir: __dirname + '/build/fonts'
},
images: {
srcDir: __dirname + '/src/client/assets/images/**/*',
buildDir: __dirname + '/build/images'
},
impulses: {
srcDir: __dirname + '/src/client/assets/impulses/**/*',
buildDir: __dirname + '/build/impulses'
},
html: {
srcFile: __dirname + '/src/client/index.html',
buildDir: __dirname + '/build'
},
server: {
buildDir: __dirname + '/build',
script: __dirname + '/src/server',
watch: [
__dirname + '/src/server',
__dirname + '/src/common'
]
},
electron: {
srcFile: __dirname + '/src/main.js',
buildDir: __dirname + '/build'
},
watch: {
js: [
__dirname + '/src/client/**/*.js',
__dirname + '/node_modules/**/*.js'
],
scss: [
__dirname + '/src/client/assets/scss/**/*.scss'
]
}
};
wrench.readdirSyncRecursive('./tasks').filter(function(file) {
return (/\.(js)$/i).test(file) && file.indexOf('config.js') === -1;
}).map(function(file) {
require('./tasks/' + file)(opts);
});
//tasks
gulp.task('default', function(callback) {
setupConfig('development');
runSequence('serve:server', 'watch', ['scripts', 'scripts:vendor', 'styles', 'fonts', 'images', 'html', 'electron'], 'serve:client');
});
gulp.on('err', function(err) {
console.log(err);
});