forked from nmxiaowei/avue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
39 lines (35 loc) · 976 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
const gulp = require("gulp");
var sass = require("gulp-sass");
var autoprefixer = require("gulp-autoprefixer");
var cssmin = require("gulp-cssmin");
const webpack = require("webpack");
const webpackConf = require("./build/build.js");
// 构建webpack配置
gulp.task("webpack", async function() {
await webpack(webpackConf, function(err, stats) {
if (err) {
console.log(err);
}
});
});
// 处理样式的配置
gulp.task("compile", function() {
return gulp
.src("./styles/index.scss")
.pipe(sass.sync())
.pipe(
autoprefixer({
browsers: ["ie > 9", "last 2 versions"],
cascade: false
})
)
.pipe(cssmin())
.pipe(gulp.dest("./lib/"));
});
// 打包文件
gulp.task("build", gulp.series(["webpack", "compile"]));
// 监听文件变化
gulp.task("watch", async function() {
gulp.watch(["./src/**", "./packages/**"], gulp.series(["webpack"]));
gulp.watch(["./styles/**"], gulp.series(["compile"]));
});