-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
64 lines (45 loc) · 1.96 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
'use strict';
////////////////////////////////////////////////////
// Preparations
////////////////////////////////////////////////////
const gulp = require('gulp'),
path = require('path'),
requireDir = require('require-dir');
// Save current working directory in global.cwd.
const cwd = global.cwd = process.cwd();
// Save gulp-tasks directory in global.gulpTasksDir.
const gulpTasksDir = global.gulpTasksDir = path.resolve(cwd, './gulp-tasks');
// Use this function to require all js files in directory 'dir', relative to the gulpTasksDir
// This makes setting up complex gulp workflows easier
const registerGulpTasks = dir => requireDir(path.resolve(gulpTasksDir, dir), { recurse: false });
// Create browserSync instance
global.browserSync = require('browser-sync').create();
////////////////////////////////////////////////////
// Define the app
////////////////////////////////////////////////////
global.app = {
compiledAppName: 'spotify-audio-features.js',
compiledAppFallbackName: 'spotify-audio-features-fallback.js',
};
// Define paths
global.paths = {
src: path.resolve(cwd, './src'),
dist: path.resolve(cwd, './dist'),
indexHTML: path.resolve(cwd, './src/index.html'),
html: path.resolve(cwd, './src/**/*.html'),
js: path.resolve(cwd, './src/js'),
configJS: path.resolve(cwd, './src/js/config.js'),
scss: path.resolve(cwd, './src/scss'),
css: path.resolve(cwd, './src/css'),
distVendorJS: path.resolve(cwd, './dist/js/vendor'),
};
////////////////////////////////////////////////////
// Register gulp tasks
////////////////////////////////////////////////////
// Microscopic tasks that run independently
registerGulpTasks('./elemental');
// Somewhat larger processes, like watching and compiling scss files
registerGulpTasks('./processes');
// Workflows, like compile/deploy/test/serve
registerGulpTasks('./workflows');
gulp.task('default', gulp.series('serve'));