-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (37 loc) · 1.73 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
// =========================================================
// NOTE: Using Gulp 4
// npm install --save-dev gulp-load-plugins gulpjs/gulp.git#4.0
// =========================================================
const gulp = require('gulp');
const config = require('./gulp/config.js');
const plugins = require('gulp-load-plugins')();
// ---------------------------------- Gulp Terminal Commands
// ---- gulp build
// --------------------function to get tasks from gulp/tasks
function getTask(task) {
return require('./gulp/tasks/' + task)(gulp, plugins);
}
// ---------------------------------------------- Gulp Tasks
gulp.task('sass', getTask('sass'));
gulp.task('scripts', getTask('scripts'));
gulp.task('php', getTask('php'));
gulp.task('image', getTask('image'));
gulp.task('static', getTask('static'));
gulp.task('revision', getTask('revision'));
gulp.task('clean', getTask('clean'));
gulp.task('sync', getTask('browsersync'));
gulp.task('watch', () => {
gulp.watch(config.styles.src, gulp.series('sass'));
gulp.watch([...new Set(Object.values(config.scripts.src).flat(Infinity))], gulp.series('scripts'));
gulp.watch([config.php.src, config.php.htaccess.src, config.php.lang.src], gulp.series('php'));
gulp.watch(config.images.src, gulp.series('image'));
gulp.watch([...config.assets.src, config.statics.src], gulp.series('static'));
});
// --------------------------------------- Default Gulp Task
gulp.task('default', gulp.series(
gulp.parallel('sass', 'scripts', 'php', 'image', 'static'), gulp.parallel('watch', 'sync')
));
// ---------------------------------------------- gulp build
gulp.task('build', gulp.series('clean',
gulp.parallel('sass', 'scripts', 'php', 'image', 'static'), 'revision'
));