-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (44 loc) · 1.21 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
let browserSync = require('browser-sync'),
gulp = require('gulp'),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
cssnano = require('cssnano'),
fonts = require('postcss-font-magician'),
sass = require('gulp-sass'),
image = require('gulp-image'),
media = require('gulp-group-css-media-queries'),
notify = require('gulp-notify');
gulp.task('browserSync', function () {
browserSync({
server: {
baseDir: 'assets'
},
notify: false
})
});
gulp.task('postcss', function () {
const processor = ([
//autoprefixer({browsers: ['last 10 version']}),
cssnano(),
fonts()
]);
return gulp.src('./assets/sass/*.sass')
.pipe(sass().on("error", notify.onError()))
.pipe(media())
.pipe(postcss(processor))
.pipe(gulp.dest('./assets/css'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('image', function () {
return gulp.src('./assets/img/**/*')
.pipe(image())
.pipe(gulp.dest('./assets/img'))
})
gulp.task('watch', ['postcss', 'browserSync'], function () {
gulp.watch('assets/sass/**/*.sass', ['postcss']);
gulp.watch('assets/*.html', browserSync.reload);
gulp.watch('assets/js/**/*.js', browserSync.reload);
});
gulp.task('default', ['watch']);