-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (37 loc) · 1.17 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
var gulp = require('gulp');
var browserSync = require('browser-sync');
var watch = require('gulp-watch');
var sass = require('gulp-sass');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var cssmin = require('gulp-cssmin');
var rename = require('gulp-rename');
//default task
gulp.task('build', ['watch']);
// css task's
gulp.task('sass', function () {
gulp.src('./src/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe( postcss([
autoprefixer({
browsers: ['last 5 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4']
})
]))
.pipe(gulp.dest('build/css'));
});
//watch task & browser-sync
gulp.task('sass-watch', ['sass'], function(){
setTimeout(function() {
browserSync.reload;
}, 200);
});
gulp.task('watch',['sass'], function() {
browserSync({
server: {
baseDir: './'
}
})
gulp.watch('./*html', browserSync.reload);
gulp.watch('./build/css/*.css');
gulp.watch('./src/scss/*.scss', ['sass-watch']);
});