-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (30 loc) · 981 Bytes
/
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
const gulp = require('gulp');
const sass = require('gulp-sass');
const rename = require('gulp-rename');
const browserSync = require('browser-sync').create();
gulp.task('copyJS', function() {
return gulp.src('app/js/*.js')
.pipe(gulp.dest('public/js/'));
});
gulp.task('sassToCSS', function() {
return gulp.src('app/scss/*.scss')
.pipe(sass({
errorLogToConsole: true,
outputStyle: 'compressed'
}))
.on('error', console.error.bind(console))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('public/css/'));
});
gulp.task('serve', function() {
browserSync.init({
server: './'
});
browserSync.watch('public/**/*.*').on('change', browserSync.reload);
browserSync.watch('*.html').on('change', browserSync.reload);
});
gulp.task('watchFiles', function() {
gulp.watch('app/scss/*.scss', gulp.series('sassToCSS'));
gulp.watch('app/js/*.js', gulp.series('copyJS'));
});
gulp.task('default', gulp.parallel('watchFiles', 'serve'));