-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
33 lines (28 loc) · 843 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
var gulp = require("gulp");
var babel = require("gulp-babel");
var uglify = require("gulp-uglify");
var postcss = require("gulp-postcss");
var autoprefixer = require("autoprefixer");
var cssnano = require("cssnano");
function htmlTask() {
return gulp.src("src/index.html").pipe(gulp.dest("dist"));
}
function jsTask() {
return gulp
.src("src/index.js")
.pipe(
babel({
presets: ["@babel/preset-env"],
})
)
.pipe(uglify())
.pipe(gulp.dest("dist"));
}
function cssTask() {
var plugins = [autoprefixer({}), cssnano()];
return gulp.src("src/*.css").pipe(postcss(plugins)).pipe(gulp.dest("dist"));
}
exports.css = gulp.task("updateCss", function () {
return gulp.watch(["src/*.css,src/*.html"], gulp.parallel(htmlTask, cssTask));
});
exports.default = gulp.parallel(htmlTask, cssTask, jsTask);