-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (41 loc) · 1.09 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
const gulp = require('gulp');
const pug = require('gulp-pug');
const sync = require('browser-sync').create();
const sass = require('gulp-sass');
gulp.task('default', ['pug', 'sass', 'javascript', 'image', 'serve', 'watch']);
gulp.task('pug', () => {
return gulp.src('src/index.pug')
.pipe(pug())
.pipe(gulp.dest('docs'));
});
gulp.task('sass', () => {
return gulp.src('src/style.sass')
.pipe(sass())
.pipe(gulp.dest('docs'))
.pipe(sync.stream());
});
gulp.task('javascript', () => {
return gulp.src('src/main.js')
.pipe(gulp.dest('docs'));
});
gulp.task('watch', () => {
gulp.watch('src/**/index.pug', ['pug']);
gulp.watch('src/**/style.sass', ['sass']);
gulp.watch('src/**/*.js', ['javascript']);
});
gulp.task('image', () => {
gulp.src('src/**/*.png')
.pipe(gulp.dest('docs'));
gulp.src('src/**/*.jpeg')
.pipe(gulp.dest('docs'));
});
// start a dev server with hotreloading
gulp.task('serve', () => {
sync.init({
server: {
baseDir: 'docs'
},
browser: 'google chrome'
});
gulp.watch('docs/index.html').on('change', sync.reload);
});