-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
42 lines (34 loc) · 1.42 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
import gulp from "gulp";
import browsersync from 'browser-sync';
import gulpIf from 'gulp-if';
import { paths } from "./gulpData/paths.js";
global.gulp = gulp;
global.if = gulpIf;
global.isProd = process.argv.includes('--prod');
global.paths = paths;
global.browsersync = browsersync;
import { html } from "./gulpData/html.js";
import { css } from "./gulpData/css.js";
import { scripts } from "./gulpData/scriptTask.js";
import { scriptModules } from "./gulpData/moduleTask.js";
import { fontsStyle, fonts } from "./gulpData/fonts.js";
import { images } from "./gulpData/images.js";
import { setupSwiperCss, setupSwiperJs } from "./gulpData/swiperInit.js";
import browserSyncFunc from "./gulpData/browserSync.js";
import del from 'del';
function watchFIles() {
gulp.watch(paths.watch.html, { usePolling: true }, html);
gulp.watch([paths.watch.css, paths.watch.demoCss], { usePolling: true }, css);
gulp.watch(paths.watch.scripts, { usePolling: true }, scripts);
gulp.watch(paths.watch.scriptModules, { usePolling: true }, scriptModules);
gulp.watch(paths.watch.images, { usePolling: true }, images);
}
function recreate() {
return del(paths.clean);
}
let build = gulp.series(recreate, setupSwiperCss, setupSwiperJs,
gulp.parallel(scripts, scriptModules, css, html, images, fonts), fontsStyle);
let watch = gulp.parallel(build, watchFIles, browserSyncFunc);
gulp.task('build', build);
gulp.task('watch', watch);
gulp.task('default', watch);