-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
39 lines (34 loc) · 1.06 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import BrowserSync from 'browser-sync';
const $ = gulpLoadPlugins();
const browserSync = BrowserSync.create();
gulp.task('js',
() => gulp.src('./src/js/*.js')
.pipe($.size())
.pipe($.plumber())
.pipe($.babel())
.pipe(gulp.dest('./dist/js'))
.pipe($.uglify())
.pipe($.rename({ extname: '.min.js'}))
.pipe(gulp.dest('./dist/js'))
.pipe($.size())
.pipe($.size({gzip: true})));
gulp.task('css',
() => gulp.src('./src/css/*.css')
.pipe($.plumber())
.pipe($.autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('./dist/css')));
gulp.task('default', ['js', 'css'],() => {
browserSync.init({
server: {
baseDir: './'
}
});
gulp.watch('./src/js/*.js', ['js']);
gulp.watch('./src/css/*.css', ['css']);
gulp.watch(['./index.html', './src/js/*.js', './src/css/*.css']).on('change', browserSync.reload);
});