-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
66 lines (59 loc) · 2.04 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
import gulp from 'gulp'
import browserSync from 'browser-sync'
import { paths } from './gulp/config/paths.js'
import { clean } from './gulp/tasks/clean.js'
import { svgSprites } from './gulp/tasks/sprite.js'
import { styles } from './gulp/tasks/styles.js'
import { stylesBackend } from './gulp/tasks/styles-backend.js'
import { scripts } from './gulp/tasks/scripts.js'
import { scriptsBackend } from './gulp/tasks/scripts-backend.js'
import { resources } from './gulp/tasks/resources.js'
import { images } from './gulp/tasks/images.js'
import { webpImages } from './gulp/tasks/webp.js'
import { htmlInclude } from './gulp/tasks/html-include.js'
import { cacheTask } from './gulp/tasks/cache.js'
import { rewrite } from './gulp/tasks/rewrite.js'
import { htmlMinify } from './gulp/tasks/html-minify.js'
import { zipFiles } from './gulp/tasks/zip.js'
global.app = {
gulp,
isProd: process.argv.includes('--build'),
paths
}
const watcher = () => {
browserSync.init({
server: {
baseDir: `${app.paths.base.build}`
},
notify: false,
port: 3000
})
gulp.watch(app.paths.srcScss, styles)
gulp.watch(app.paths.srcFullJs, scripts)
gulp.watch(`${app.paths.srcComponentsFolder}/*.html`, htmlInclude)
gulp.watch(`${app.paths.base.src}/pages/*.html`, htmlInclude)
gulp.watch(`${app.paths.assetsFolder}/**`, resources)
gulp.watch(`${app.paths.srcImgFolder}/**/**.{jpg,jpeg,png,svg}`, images)
gulp.watch(`${app.paths.srcImgFolder}/**/**.{jpg,jpeg,png}`, webpImages)
gulp.watch(app.paths.srcSvg, svgSprites)
}
const dev = gulp.series(clean, htmlInclude, scripts, styles, resources, images, webpImages, svgSprites, watcher)
const backend = gulp.series(
clean,
htmlInclude,
scriptsBackend,
stylesBackend,
resources,
images,
webpImages,
svgSprites
)
const build = gulp.series(clean, htmlInclude, scripts, styles, resources, images, webpImages, svgSprites, htmlMinify)
const cache = gulp.series(cacheTask, rewrite)
const zip = zipFiles
export { dev }
export { build }
export { backend }
export { cache }
export { zip }
gulp.task('default', dev)