-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (42 loc) · 1.15 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
let gulp = require('gulp');
let sass = require('gulp-sass');
let browserSync = require('browser-sync').create();
let useref = require('gulp-useref');
let uglify = require('gulp-uglify');
let del = require('del');
let babel = require('gulp-babel');
let concat = require('gulp-concat');
let rename = require('gulp-rename');
let cleanCSS = require('gulp-clean-css');
gulp.task('sass', function() {
return gulp.src('app/scss/**/*.scss')
.pipe(sass())
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(rename('styles.min.css'))
.pipe(gulp.dest('app/css'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('js', function () {
return gulp.src('app/jsx/**/*.js')
.pipe(babel())
.pipe(concat('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest('app/js'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: 'app'
},
})
});
gulp.task('watch', ['browserSync', 'sass', 'js'], function(){
gulp.watch('app/scss/**/*.scss', ['sass']);
gulp.watch('app/jsx/**/*.js', ['js']);
gulp.watch('app/*.html', browserSync.reload);
});