-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
52 lines (41 loc) · 1.28 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
var gulp = require('gulp');
// Requires the gulp-sass plugin
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
var pug = require('gulp-pug');
var runSequence = require('run-sequence');
var open = require('gulp-open');
gulp.task('pug', function() {
return gulp.src('src/files/**/*.pug') // Gets all files ending with .scss in app/scss
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest('public'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('sass', function() {
return gulp.src('src/scss/**/*.scss') // Gets all files ending with .scss in app/scss
.pipe(sass())
.pipe(gulp.dest('public/css'))
.pipe(browserSync.reload({
stream: true
}))
});
// Browser sync to refresh the browser whenever a file is changed
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: 'public',
open: "http://google.com"
}
})
});
// Watch function to check for any changes
gulp.task('run',gulp.parallel('browserSync', gulp.series('sass','pug')));
gulp.task('watch', function(){
gulp.watch('src/scss/*.scss',gulp.series('sass')),
gulp.watch('src/files/**/*.pug', gulp.series('pug'));
});
gulp.task('default', gulp.parallel('watch', 'run'));