-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
37 lines (32 loc) · 963 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
37
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var sass = require('gulp-ruby-sass');
var plumber = require('gulp-plumber');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
browserSync.init({
proxy: 'localhost:5000'
});
gulp.task('sass', () => {
return sass('src/sass/**/*.sass')
.on('error', sass.logError)
.pipe(gulp.dest('public/css'))
.pipe(browserSync.stream())
});
gulp.task('babel', () => {
return gulp.src(['src/js/*.js', 'src/config/*.js'])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['env', 'es2015', 'stage-2']
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('public/js'))
.pipe(browserSync.stream())
})
gulp.task('watch', function () {
gulp.watch('src/js/*.js', ['babel']);
gulp.watch('src/sass/**/*.sass', ['sass']);
})
gulp.task('default', ['babel', 'sass', 'watch'])