-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (62 loc) · 2.19 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
import loadPlugins from 'gulp-load-plugins'
export let $ = loadPlugins({
overridePattern: true,
pattern: ['gulp-*', 'gulp.*', '@*/gulp{-,.}*', 'postcss-*', 'posthtml-*',],
config: process.env.npm_package_json,
})
import gulp from 'gulp'
import { paths } from './gulp/paths.js'
import browsersyncFunc from './gulp/browserSync.js'
export const isProd = process.argv.includes('--prod')
import html from './gulp/html.js'
import php from './gulp/php.js'
import css, { environmentCss } from './gulp/css.js'
import scripts, { libs } from './gulp/scripts.js'
import fonts, { fontsStyle } from './gulp/fonts.js'
import images, { imagesSvg } from './gulp/images.js'
import video from './gulp/video.js'
import deleteUnlinkFiles from './gulp/deleteUnlinkFiles.js'
import deleteDist from './gulp/deleteDist.js'
function watchFIles() {
gulp.watch(paths.watch.html, { usePolling: true }, html)
.on('unlink', (filePath) => {
deleteUnlinkFiles(filePath)
})
gulp.watch(paths.watch.php, php)
.on('unlink', (filePath) => {
deleteUnlinkFiles(filePath)
})
gulp.watch(paths.watch.css, { usePolling: true }, css)
.on('unlink', (filePath) => {
deleteUnlinkFiles(filePath, ['.min.css', '.css'])
})
gulp.watch(paths.watch.cssNoAccessToDist, environmentCss)
gulp.watch(paths.watch.scripts, scripts)
.on('unlink', (filePath) => {
deleteUnlinkFiles(filePath, ['.js'])
})
gulp.watch(paths.watch.scriptModules, scripts)
.on('unlink', (filePath) => {
deleteUnlinkFiles(filePath, ['.js'])
})
gulp.watch(paths.watch.images, images)
.on('unlink', (filePath) => {
deleteUnlinkFiles(filePath, ['.webp', '.avif'])
})
gulp.watch(paths.watch.imagesSvg, imagesSvg)
.on('unlink', (filePath) => {
deleteUnlinkFiles(filePath)
})
gulp.watch(paths.watch.video, video)
.on('unlink', (filePath) => {
deleteUnlinkFiles(filePath)
})
}
const mainTasks = [
html, css, environmentCss, fonts, scripts, php, imagesSvg, images, video,
]
let build = gulp.series(deleteDist, gulp.parallel(libs, mainTasks), fontsStyle)
let watch = gulp.parallel(build, watchFIles, browsersyncFunc)
gulp.task('build', build)
gulp.task('watch', watch)
gulp.task('default', watch)