-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (48 loc) · 1.11 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
54
55
56
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
var del = require('del');
var browserSync = require('browser-sync').create();
var paths = {
html: {
src: 'src/index.html',
dest: 'dist/',
},
styles: {
src: 'src/styles.css',
dest: 'dist/css',
}
}
function clean() {
return del(['dist']);
}
function copyHTML() {
return gulp.src(paths.html.src)
.pipe(gulp.dest(paths.html.dest));
}
function styles() {
return gulp.src(paths.styles.src)
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false,
grid: true
}))
.pipe(gulp.dest(paths.styles.dest))
.pipe(browserSync.stream());
}
function watch() {
gulp.watch(paths.html.src, copyHTML);
gulp.watch(paths.styles.src, styles);
}
function webserver() {
browserSync.init({
server: {
baseDir: "./dist"
},
open: false
});
}
var build = gulp.series(clean, gulp.parallel(copyHTML, styles));
gulp.task('build', build);
gulp.task('default', gulp.series(build, gulp.parallel(webserver, watch)));