-
Notifications
You must be signed in to change notification settings - Fork 15
/
gulpfile.js
88 lines (77 loc) · 2.7 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
/* eslint-disable max-len */
/**
* Rather than manage one giant configuration file responsible
* for creating multiple tasks, each task has been broken out into
* its own file in gulp/tasks. Any files in that directory get
* automatically required below.
* To add a new task, simply add a new task file in the tasks directory.
*/
'use strict';
let gulp = require('gulp'),
path = require('path'),
config = require('./config/build'),
runSequence = require('gulp4-run-sequence'),
browserSync = require('browser-sync'),
requireDir = require('require-dir');
global.rootRequire = function (name) {
return require(__dirname + '/' + name);
};
/**
* Require all tasks in gulp/tasks, including sub folders
*/
requireDir('./gulp/tasks', {
recurse: true
});
/**
* Default task clean temporaries directories and launch the
* main optimization build task
*/
// gulp.task('default', ['clean'], function () {
// gulp.start('build');
// });
gulp.task('prod', function (callback) {
return runSequence(
['clean-all'],
['env-constants'],
['assets'],
['build:vendor'],
['vendorAssets'],
['vendor-styles'],
['stylus'],
['scripts'],
['dataRepo'],
['derivedDataset'],
['speciesLookup'],
['nameParser'],
['sequenceMatching'],
['occurrenceSnapshots'],
['observationTrends'],
['home'],
['ipt'],
['templates'],
['ieStyle'],
callback);
});
gulp.task('test', gulp.series('test-client', 'test-server'));
gulp.task('watch', function () {
gulp.watch([
path.join(config.paths.src, '/**/*.styl'),
path.join(config.paths.src, '/**/*.less'),
path.join(config.paths.src, '/**/*.css')
], gulp.series('stylus-reload', 'ieStyle'));
//, 'dataRepo', 'speciesLookup', 'dataValidator', 'ipt', 'observationTrends', 'home' //removed because they are slow to wait for. If you are developing this add again. Not ideal, but it seem to slow things down quite a bit
gulp.watch(config.js.client.watch, gulp.series('scripts-reload', 'home', 'client-lint'));
gulp.watch([path.join(config.paths.src, '/**/*.{html,nunjucks}')], gulp.series('templates'));
});
gulp.task('dev', function (callback) {
runSequence(
['clean-all'],
// ['revision'],
['env-constants'],
['build:vendor', 'stylus-reload', 'vendor-styles', 'scripts-reload', 'assets', 'vendorAssets', 'speciesLookup', 'nameParser', 'sequenceMatching', 'ipt', 'observationTrends', 'home', 'dataRepo', 'derivedDataset', 'occurrenceSnapshots'],
['templates'],
['ieStyle'],
['watch'],
callback);
});
gulp.task('default', gulp.task(config.buildType));