-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathgulpfile.js
More file actions
41 lines (34 loc) · 1.21 KB
/
Copy pathgulpfile.js
File metadata and controls
41 lines (34 loc) · 1.21 KB
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
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/**/*", "!./src/public/images/**"]).pipe(gulp.dest("build/public"));
}
export function assetsCopy() {
return gulp.src(["./src/public/images/**"], { encoding: false }).pipe(gulp.dest("build/public/images"));
}
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, assetsCopy, staticCompile, staticSwapReactProduction, staticClean);