-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
42 lines (36 loc) · 920 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
38
39
40
41
42
var gulp = require('gulp'),
postcss = require('gulp-postcss'),
sourcemaps = require('gulp-sourcemaps'),
nested = require('postcss-nested'),
mediaMinmax = require('postcss-media-minmax'),
customMedia = require('postcss-custom-media'),
browserSync = require("browser-sync").create();
function style() {
return gulp
.src('styles.css')
.pipe(sourcemaps.init())
.pipe(postcss([
nested(),
mediaMinmax(),
customMedia()
]))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./post'))
.pipe(browserSync.stream());
}
function reload() {
browserSync.reload();
}
function watch() {
browserSync.init({
server: {
baseDir: './'
}
});
gulp.watch('styles.css', style);
gulp.watch('index.html').on('change', browserSync.reload);
}
exports.watch = watch;
exports.style = style;
var run = gulp.parallel(style, watch);
gulp.task('default', run);