-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
53 lines (42 loc) · 1.25 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'),
sass = require('gulp-sass'),
browserSync = require('browser-sync').create(),
autoprefixer = require('gulp-autoprefixer'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant');
gulp.task('sass', function(){
return gulp.src('app/scss/*.scss')
.pipe(sass())
.pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
.pipe(gulp.dest('app/css/'))
.pipe(browserSync.stream());
//.pipe(browserSync.reload({stream: true}));
})
gulp.task('browserSync', function(){
browserSync.init({
server:{
baseDir:'app'
},
port: 8081,
open: true,
notify: false
});
})
gulp.task('img', function(){
return gulp.src('app/img/*')
.pipe(imagemin({
interlaced: true,
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('img/imgmin'))
})
gulp.task('watch', ['browserSync', 'sass'], function(){
setTimeout(function(){
gulp.watch('app/scss/*.scss', [sass]);
gulp.watch('app/*.html', browserSync.reload)
gulp.watch('app/js/*.js', browserSync.reload)
gulp.watch('app/libs/*.js', browserSync.reload)
},1000)
})