-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
116 lines (97 loc) · 2.92 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
114
115
116
/**
* Setup
*/
process.title = process.title || 'gulp';
/**
* Dependencies
*/
const path = require('path');
const gulp = require('gulp');
/**
* Setup
*/
const tasks = require(path.resolve(__dirname, 'gulp/tasks'));
const config = require(path.resolve(__dirname, 'gulp/config'));
/**
* Tasks
*/
gulp.task('build:clean', function buildClean() {
tasks.clean(config.paths.build);
return tasks.clean(config.paths.dist);
});
gulp.task('build:styles', function buildStyles() {
return tasks.css(config.styles.source, {less: {paths: config.styles.npmPaths}})
.pipe(gulp.dest(config.styles.dist));
});
gulp.task('build:js', function buildJS() {
return tasks.browserify(config.scripts.main)
.pipe(gulp.dest(config.scripts.dist));
});
gulp.task('manifest', function manifest() {
return tasks.rev(config.manifest.source)
.pipe(gulp.dest(config.paths.dist))
.pipe(tasks.manifest())
.pipe(gulp.dest(config.paths.build));
});
gulp.task('build:copy-icons', function() {
return tasks.copy(config.fonts.sources)
.pipe(gulp.dest(config.fonts.dist));
});
gulp.task('build:copy-images', function() {
return tasks.copy(config.images.sources).pipe(gulp.dest(config.images.dist));
});
gulp.task('build:script-include', function () {
return tasks.handlebars(config.templates.manifestPath, config.templates.scriptsTemplate, config.staticUrlRoot)
.pipe(gulp.dest(config.templates.destination));
});
gulp.task('build:style-include', function () {
return tasks.handlebars(config.templates.manifestPath, config.templates.stylesTemplate, config.staticUrlRoot)
.pipe(gulp.dest(config.templates.destination));
});
gulp.task('test', function test() {
return tasks.test(config.test.all);
});
gulp.task('test:req', function testReq() {
return tasks.test(config.test.req);
});
gulp.task('test:components', function testComponents() {
return tasks.test(config.test.components);
});
gulp.task('xo', function xo() {
return tasks.xo(config.xo.source);
});
gulp.task('optimize:js', function () {
return tasks.optimizejs(config.optimize.js.source, config.optimize.js.options, config.optimize.js.dist);
});
gulp.task('optimize:css', function () {
return tasks.optimizecss(config.optimize.css.source, config.optimize.css.options, config.optimize.css.dist);
});
/**
* Compound Tasks
*/
gulp.task('watch', function watch() {
gulp.watch(config.watch.styles, gulp.series(['build:styles', 'manifest', 'build:style-include']));
gulp.watch(config.watch.scripts, gulp.series(['build:js', 'manifest', 'build:script-include']));
});
gulp.task('build', gulp.series([
'xo',
'build:clean',
gulp.parallel([
'build:styles',
'build:js',
'build:copy-icons',
'build:copy-images'
]),
'manifest',
'build:script-include',
'build:style-include'
]));
gulp.task('default', gulp.series([
'build',
'watch'
]));
gulp.task('release', gulp.series([
'build',
'optimize:js',
'optimize:css'
]));