-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (46 loc) · 1.41 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
53
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'),
bourbon = require('node-bourbon'),
media = require('gulp-group-css-media-queries'),
notify = require('gulp-notify'),
pug = require('gulp-pug');
gulp.task('browserSync', function () {
browserSync({
server: {
baseDir: './'
},
notify: false
})
});
gulp.task('postcss', function () {
const processor = ([
//autoprefixer({browsers: ['last 10 version']}),
cssnano(),
fonts()
]);
return gulp.src('./sass/*.sass')
.pipe(sass({includePaths: bourbon.includePaths}).on("error", notify.onError()))
.pipe(media())
.pipe(postcss(processor))
.pipe(gulp.dest('./css'))
.pipe(browserSync.reload({stream: true}))
});
gulp.task('pug', function buildHTML() {
return gulp.src('./*.pug')
.pipe(pug({
pretty: true
}).on("error", notify.onError()))
.pipe(gulp.dest('./'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('watch', ['postcss', 'pug', 'browserSync'], function () {
gulp.watch('./sass/**/*.sass', ['postcss']);
gulp.watch(['./*.pug', './pug/**/*.pug'], ['pug']);
gulp.watch('./js/**/*.js', browserSync.reload);
});
gulp.task('default', ['watch']);