forked from plugCubed/plugCubed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
74 lines (57 loc) · 2.65 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
'use strict';
const path = require('path');
const gulp = require('gulp');
const HubRegistry = require('gulp-hub');
const tryRequire = require('try-require');
const devVersion = tryRequire(path.resolve('src', 'dev', 'version.js'));
const devVersionExists = devVersion != null && typeof devVersion === 'object';
const regex = devVersionExists ? ['tasks/**/*.js'] : 'tasks/**/+(*?(a|A)lpha*|*?(c|C)hrome*|*?(m|M)axthon*|*?(f|F)irefox*|*?(o|O)pera*|*?(r|R)elease*).js';
const hub = new HubRegistry(regex);
gulp.registry(hub);
gulp.task('minify:alpha', gulp.parallel('minify:alphaJS', 'minify:alphaCSS', (done) => {
done();
}));
gulp.task('minify:release', gulp.parallel('minify:releaseJS', 'minify:releaseCSS', (done) => {
done();
}));
gulp.task('build:alpha', gulp.series('clean:alpha', 'replace:linksAlpha', 'requirejs:alpha', 'replace:versionAlpha', 'autoprefixer:alpha', 'template:alpha', 'minify:alpha', (done) => {
done();
}));
gulp.task('build:extensions', gulp.parallel(['replace:extensionChrome', 'replace:extensionFirefox', 'replace:extensionMaxthon'], ['extensions:chrome', 'extensions:firefox', 'extensions:opera', 'extensions:maxthon'], (done) => {
done();
}));
gulp.task('build:release', gulp.series('clean:release', 'replace:linksRelease', 'requirejs:release', 'replace:versionRelease', 'autoprefixer:release', 'template:release', ['build:extensions', 'minify:release'], (done) => {
done();
}));
if (devVersionExists) {
gulp.task('build:all', gulp.series('build:alpha', 'build:dev', 'build:release', (done) => {
done();
}));
gulp.task('build:dev', gulp.series('clean:dev', 'replace:linksDev', 'requirejs:dev', 'replace:versionDev', 'autoprefixer:dev', 'template:dev', (done) => {
done();
}));
gulp.task('watch:dev', (done) => {
const devWatcher = gulp.watch('**/*.{css,js}', {
cwd: path.resolve('src', 'dev')
}, ['build:dev']);
devWatcher.on('change', (event) => {
console.log(`File ${event.path} was ${event.type} running build:dev task...`);
});
});
}
gulp.task('watch:alpha', (done) => {
const alphaWatcher = gulp.watch('**/*.{css,js}', {
cwd: path.resolve('src', 'alpha')
}, ['build:alpha']);
alphaWatcher.on('change', (event) => {
console.log(`File ${event.path} was ${event.type} running build:alpha task...`);
});
});
gulp.task('watch:release', (done) => {
const releaseWatcher = gulp.watch('**/*.{css,js}', {
cwd: path.resolve('src', 'release')
}, ['build:release']);
releaseWatcher.on('change', (event) => {
console.log(`File ${event.path} was ${event.type} running build:release task...`);
});
});