forked from htmlacademy-adaptive/2022605-pink-25
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (39 loc) · 945 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
43
44
45
46
47
48
import gulp from 'gulp';
import plumber from 'gulp-plumber';
import less from 'gulp-less';
import postcss from 'gulp-postcss';
import autoprefixer from 'autoprefixer';
import browser from 'browser-sync';
import svgstore from 'gulp-svgstore';
import svgo from 'gulp-svgmin';
// Styles
export const styles = () => {
return gulp.src('source/less/style.less', { sourcemaps: true })
.pipe(plumber())
.pipe(less())
.pipe(postcss([
autoprefixer()
]))
.pipe(gulp.dest('source/css', { sourcemaps: '.' }))
.pipe(browser.stream());
}
// Server
const server = (done) => {
browser.init({
server: {
baseDir: 'source'
},
cors: true,
notify: false,
ui: false,
});
done();
}
// Watcher
const watcher = () => {
gulp.watch('source/less/**/*.less', gulp.series(styles));
gulp.watch('source/*.html').on('change', browser.reload);
}
export default gulp.series(
styles, server, watcher
);