-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (48 loc) · 1.33 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"use strict";
var gulp = require('gulp'),
sync = require('browser-sync'),
scss = require('gulp-sass'),
watch = require('gulp-watch'),
del = require('del'),
babel = require('gulp-babel'),
browserSync = require('browser-sync');
gulp.task('scss', function () {
return gulp.src('app/*.scss')
.pipe(scss())
.pipe(gulp.dest('dist'));
});
gulp.task('html', function () {
return gulp.src('app/index.html')
.pipe(gulp.dest('dist'));
});
gulp.task('js', function () {
return gulp.src('app/js/**/*')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist/js'));
});
gulp.task('images', function () {
return gulp.src('app/img/**/*')
.pipe(gulp.dest('dist/img/'))
});
gulp.task('clean', function() {
return del.sync('dist');
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: 'dist'
},
notify: false
});
});
gulp.task('clear', function () {
return cache.clearAll();
});
gulp.task('watch', ['clean', 'js', 'images', 'scss', 'html', 'browser-sync'], function() {
gulp.watch('app/*.scss', ['scss', browserSync.reload]);
gulp.watch('app/*.html', ['html', browserSync.reload]);
gulp.watch('app/js/*.js', ['js', browserSync.reload]);
});
gulp.task('default', ['watch']);