-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
42 lines (32 loc) · 1 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const concat = require('gulp-concat');
const browserSync = require('browser-sync').create();
const babel = require("gulp-babel");
function handleError(err) {
console.log(err.toString());
this.emit('end');
}
gulp.task('sass', function() {
return gulp.src("./sass/main.scss")
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest("./dist/css/"))
.pipe(browserSync.stream());
});
gulp.task('js', function() {
return gulp.src("./js/main.js")
.pipe(babel({
presets: ['es2015', 'react']
}))
.on('error', handleError)
.pipe(gulp.dest('./dist/js/'));
});
gulp.task('browserSync', ['sass', 'js'], function() {
browserSync.init({
server: "./"
});
gulp.watch("./sass/**/*.scss", ['sass']);
gulp.watch("./js/**/*.js", ['js']).on('change', browserSync.reload);
gulp.watch("./**/*.html").on('change', browserSync.reload);
});
gulp.task('default', ['browserSync']);