This repository has been archived by the owner on Feb 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
76 lines (52 loc) · 1.5 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
var gulp = require('gulp'),
del = require('del'),
browserSync = require('browser-sync'),
autoprefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass');
gulp.task('sass', function() {
return gulp.src('src/sass/**/*.sass')
.pipe(sass())
.pipe(autoprefixer([
'last 10 versions'
], {
cascade: true
}))
.pipe(gulp.dest('src/css/'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: 'src'
},
notify: false
});
});
gulp.task('img', function() {
return gulp.src('src/img/**/*')
.pipe(gulp.dest('dist/img'));
});
gulp.task('clean', async function() {
return del.sync('dist');
});
gulp.task('watch', function() {
gulp.watch('src/sass/**/*.sass', gulp.parallel('sass'));
gulp.watch('src/js/**/*.js', browserSync.reload);
gulp.watch('src/**/*.html', browserSync.reload);
});
gulp.task('prebuild', async function() {
var buildCss = gulp.src('src/css/**/*')
.pipe(gulp.dest('dist/css'));
var buildVideo = gulp.src('src/video/**/*')
.pipe(gulp.dest('dist/video'));
var buildFonts = gulp.src('src/fonts/**/*')
.pipe(gulp.dest('dist/fonts'));
var buildJs = gulp.src('src/js/**/*')
.pipe(gulp.dest('dist/js'));
var buildHtml = gulp.src('src/*.html')
.pipe(gulp.dest('dist'));
var buildRedirects = gulp.src('src/_redirects')
.pipe(gulp.dest('dist'));
});
gulp.task('build', gulp.parallel('prebuild', 'clean', 'img', 'sass'));
gulp.task('default', gulp.parallel('watch', 'browser-sync'));