-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
103 lines (90 loc) · 1.75 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
const gulp = require("gulp")
const sass = require('gulp-sass')
const image = require('gulp-image')
const paths = {
src: {
js: "src/js/**/*.js",
images: "src/images/**/*",
fonts: "src/fonts/*",
sass: "src/sass/**/*.+(sass|scss)"
},
build: {
js: "public/assets/js/",
images: "public/assets/images/",
fonts: "public/assets/fonts/",
sass: "public/assets/css/"
}
};
/**
*
*/
gulp.task('js:compress', () => {
return gulp
.src(paths.src.js)
.pipe(gulp.dest(paths.build.js))
});
/**
*
*/
gulp.task('update:fonts', () => {
return gulp
.src(paths.src.fonts)
.pipe(gulp.dest(paths.build.fonts))
});
/**
*
*/
gulp.task('update:images', () => {
return gulp
.src(paths.src.images)
.pipe(image())
.pipe(gulp.dest(paths.build.images))
});
/**
*
*/
gulp.task('update:js', gulp.series('js:compress'));
/**
*
*/
gulp.task('update:sass', () => {
return gulp
.src(paths.src.sass)
.pipe(
sass({
outputStyle: 'compressed'
})
.on('error', sass.logError)
)
.pipe(gulp.dest(paths.build.sass))
});
/**
*
*/
gulp.task('watch:fonts', () =>
gulp.watch(paths.src.js, gulp.series('update:fonts'))
);
/**
*
*/
gulp.task('watch:images', () =>
gulp.watch(paths.src.images, gulp.series('update:images'))
);
/**
*
*/
gulp.task('watch:js', () =>
gulp.watch(paths.src.js, gulp.series('update:js'))
);
/**
*
*/
gulp.task('watch:sass', () =>
gulp.watch(paths.src.sass, gulp.series('update:sass'))
);
/**
*
*/
gulp.task('watch:all', gulp.parallel('watch:js', 'watch:sass', 'watch:images', 'watch:fonts'))
gulp.task('default', gulp.series('watch:all'))
gulp.task('build', gulp.parallel('js:compress', 'update:fonts', 'update:images', 'update:sass'))