-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathgulpfile.js
65 lines (57 loc) · 1.26 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
57
58
59
60
61
62
63
64
65
const gulp = require("gulp");
const babel = require("gulp-babel");
const uglifycss = require("gulp-uglifycss");
const concat = require("gulp-concat");
function getPresets(env) {
return [
[
"@babel/env",
{
loose: true,
modules: env === "es" ? false : "commonjs"
}
],
"@babel/react"
];
}
function getPlugins() {
return ["@babel/plugin-proposal-class-properties"];
}
gulp.task("cjs", () => {
return gulp
.src("src/**/*.js")
.pipe(
babel({
presets: getPresets("cjs"),
plugins: getPlugins()
})
)
.pipe(gulp.dest("."));
});
gulp.task("es", () => {
return gulp
.src("src/**/*.js")
.pipe(
babel({
presets: getPresets("es"),
plugins: getPlugins()
})
)
.pipe(gulp.dest("es"));
});
gulp.task("css", () => {
return gulp
.src("src/styles/**/*.css")
.pipe(uglifycss())
.pipe(concat("chessground.css"))
.pipe(gulp.dest("dist/styles"));
});
// gulp.task("assets", () => {
// return gulp
// .src("chessground-examples/assets/**/*")
// .pipe(gulp.dest("dist/assets"));
// });
gulp.task("img", () => {
return gulp.src("src/images/**/*").pipe(gulp.dest("dist/images"));
});
gulp.task("default", gulp.parallel(["cjs", "es", "css", "img"]));