-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (30 loc) · 998 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
const
gulp = require('gulp'),
browserify = require('browserify'),
sass = require('gulp-sass'),
browserSync = require('browser-sync').create(),
source = require('vinyl-source-stream');
gulp.task('server', () => {
browserSync.init({
server: './'
})
gulp.watch('./scripts/**/*.js', gulp.parallel(['scripts']));
gulp.watch('./style/**/*.scss', gulp.parallel(['styles']));
gulp.watch('./index.html').on('change', () => browserSync.reload());
})
gulp.task('scripts', () => {
return (
browserify('./scripts/index.js')
.bundle()
.pipe(source('./index.js'))
.pipe(gulp.dest('./'))
.pipe(browserSync.reload({ stream: true }))
)
})
gulp.task('styles', () => {
return gulp.src('./style/index.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./'))
.pipe(browserSync.reload({ stream: true }))
})
gulp.task('default', gulp.parallel(['server']));