-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·48 lines (41 loc) · 1.23 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
var gulp = require('gulp')
var browserSync = require('browser-sync').create()
var sass = require('gulp-sass')
var autoprefixer = require('gulp-autoprefixer')
var cachebust = require('gulp-cache-bust')
var reload = browserSync.reload
gulp.task('sass', function() {
return gulp
.src('src/scss/styles.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest('dest/css'))
.pipe(reload({ stream: true }))
})
gulp.task('html', function() {
return gulp
.src('./src/**/*.html')
.pipe(cachebust({ type: 'timestamp' }))
.pipe(gulp.dest('dest'))
.pipe(reload({ stream: true }))
})
gulp.task('js', function() {
return gulp
.src('./src/**/*.js')
.pipe(cachebust({ type: 'timestamp' }))
.pipe(gulp.dest('dest'))
.pipe(reload({ stream: true }))
})
gulp.task('assets', function() {
return gulp.src('./src/assets/**/*').pipe(gulp.dest('dest/assets'))
})
gulp.task('serve', function() {
browserSync.init({
server: './dest',
notify: false,
})
gulp.watch('src/**/*.html', gulp.series('html'))
gulp.watch('src/**/*.js', gulp.series('js'))
gulp.watch('src/scss/**/*.scss', gulp.series('sass'))
})
gulp.task('default', gulp.series('html', 'js', 'sass', 'assets', 'serve'))