-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (33 loc) · 934 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 browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var cssnano = require('cssnano');
var uglify = require('gulp-uglify');
var pump = require('pump');
gulp.task('css', function () {
var processors = [
cssnano(),
];
return gulp.src('./sass/**/*.+(sass|scss)')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css/'))
.pipe(browserSync.stream());
});
gulp.task('js', function (cb) {
pump([
gulp.src('./scripts/**/*.js'),
uglify(),
gulp.dest('./js/')
],
cb
)
.pipe(browserSync.stream());
});
gulp.task('default', ['css', 'js'], function(){
browserSync.init({
server: './'
});
gulp.watch('./**/*.+(sass|scss)', ['css']);
gulp.watch('./scripts/**/*.js', ['js']);
gulp.watch('./**/*.html').on('change', browserSync.reload);
});