-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
37 lines (31 loc) · 1.03 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
import gulp from "gulp";
import babel from "gulp-babel";
import debug from "gulp-debug";
import replace from "gulp-replace";
import { deleteAsync } from "del";
export function staticCopy() {
return gulp.src("./src/public/**/*").pipe(gulp.dest("build/public"));
}
export function staticClean() {
return deleteAsync(["./build/public/components"]);
}
export function staticCompile() {
return gulp
.src("./src/public/components/*.js")
.pipe(debug({ title: "Ready for compile" }))
.pipe(
babel({
presets: ["@babel/react"]
})
)
.pipe(gulp.dest("./build/public/compiled"));
}
export function staticSwapReactProduction() {
return gulp
.src(["./build/public/index.html"])
.pipe(debug())
.pipe(replace(".development.js", ".production.min.js"))
.pipe(replace('<!-- Note: when deploying, replace "development.js" with "production.min.js". -->', ""))
.pipe(gulp.dest("./build/public"));
}
export const static_build = gulp.series(staticCopy, staticCompile, staticSwapReactProduction, staticClean);