-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
132 lines (119 loc) · 2.49 KB
/
gulpfile.babel.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* eslint-env node, es6 */
'use strict';
/*
* Setup Gulp and our Task class
*/
import gulp from 'gulp';
import gutil from 'gulp-util';
import Task from './gulp/bootstrap/task';
import { packageOptions, gulpOptions } from './gulp/bootstrap/config';
/*
* Configure
*/
const paths = {
root: './',
dist: './dist/'
};
export const folders = {
scripts: `${paths.root}js/`,
test: `${paths.root}test/`,
example: `${paths.root}example/`,
dictionaries: 'node_modules/typo-js/dictionaries/en_US/',
npm: 'node_modules/'
};
export const dist = {
root: `${paths.dist}`,
scripts: `${paths.dist}js/`,
dictionaries: `${paths.dist}dictionaries/en_US/`
};
/*
* Change default options like:
*
* packageOptions.postcssUrls.rules.push({
* from: 'font/winternote',
* to: '../fonts/winternote/winternote'
* });
*/
export { packageOptions, gulpOptions };
/*
* Import all our tasks
*/
import { lintScripts } from './gulp/lint';
import { scripts } from './gulp/scripts';
import { copy } from './gulp/copy';
import { clean } from './gulp/clean';
import { bust } from './gulp/rev';
import { modernizr } from './gulp/modernizr';
/*
* Define the tasks
*/
export const taskConfig = {
scripts: [
new Task(
[
'typo-js/typo.js'
],
folders.npm,
dist.scripts + 'vendor.js',
{
babel: false,
uglify: true
}
),
new Task(
[
'is_strong_password.js'
],
folders.scripts,
dist.scripts + 'app.js',
{
babel: true,
uglify: true
}
)
],
copy: [
new Task(
['*'],
folders.example,
dist.root
),
new Task(
['*'],
folders.dictionaries,
dist.dictionaries
)
]
};
/*
* Task: Watch files and perform task when changed
*/
function watch() {
gutil.env.continue = true;
gulp.watch(folders.scripts + '**/*.js', gulp.parallel(scripts, lintScripts));
}
/*
* Combine tasks
*/
const lint = gulp.parallel(lintScripts);
const build = gulp.series(
clean,
gulp.parallel(lint, scripts, modernizr, copy),
bust
);
/*
* All tasks
*/
export {
watch,
build,
scripts,
lint,
lintScripts,
copy,
modernizr
};
/*
* Export a default task
*/
export default build;