-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
38 lines (33 loc) · 1014 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
38
const gulp = require('gulp');
const sass = require('gulp-sass');
const concat = require('gulp-concat');
const babel = require('gulp-babel');
const browsersync = require('browser-sync').create();
const autoprefixer = require('gulp-autoprefixer');
const reload = browsersync.reload;
gulp.task('styles', () => {
return gulp.src('./dev/styles/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(concat('style.css'))
.pipe(gulp.dest('./public/styles'))
.pipe(reload({stream: true}));
});
gulp.task('javascript', () => {
return gulp.src('./dev/scripts/main.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('./public/scripts'))
.pipe(reload({stream: true}));
});
gulp.task('browserRefresh', () => {
browsersync.init({
server: '.'
})
});
gulp.task('watch', () => {
gulp.watch('./dev/scripts/*.js', ['javascript'])
gulp.watch('./dev/styles/**/*.scss', ['styles'])
gulp.watch('./*.html', reload);
});
gulp.task('default', ['browserRefresh', 'styles', 'javascript', 'watch'])