Skip to content

Commit 9411b7c

Browse files
committed
- Migrate from Gulp 3 to Gulp 4 including Gulpfile
- Migrate from Babel 6 to Babel 7 including .babelrc
1 parent 3ffe767 commit 9411b7c

File tree

6 files changed

+9005
-18781
lines changed

6 files changed

+9005
-18781
lines changed

.babelrc

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"presets": ["env"],
2+
"presets": [
3+
"@babel/preset-env"
4+
],
35
"plugins": [
4-
"syntax-object-rest-spread",
5-
"transform-object-rest-spread"
6+
"@babel/plugin-syntax-object-rest-spread",
7+
"@babel/plugin-proposal-object-rest-spread"
68
]
79
}

gulpfile.babel.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ const browserSync = BrowserSync.create();
1717
const hugoArgsDefault = ["-d", "../dist", "-s", "site", "-v"];
1818
const hugoArgsPreview = ["--buildDrafts", "--buildFuture"];
1919

20-
// Development tasks
21-
gulp.task("hugo", (cb) => buildSite(cb));
22-
gulp.task("hugo-preview", (cb) => buildSite(cb, hugoArgsPreview));
23-
24-
// Run server tasks
25-
gulp.task("server", ["hugo", "css", "js", "fonts"], (cb) => runServer(cb));
26-
gulp.task("server-preview", ["hugo-preview", "css", "js", "fonts"], (cb) => runServer(cb));
27-
28-
// Build/production tasks
29-
gulp.task("build", ["css", "js", "fonts"], (cb) => buildSite(cb, [], "production"));
30-
gulp.task("build-preview", ["css", "js", "fonts"], (cb) => buildSite(cb, hugoArgsPreview, "production"));
31-
3220
// Compile CSS with PostCSS
3321
gulp.task("css", () => (
3422
gulp.src("./src/css/*.css")
@@ -53,7 +41,7 @@ gulp.task("js", (cb) => {
5341
});
5442

5543
// Move all fonts in a flattened directory
56-
gulp.task('fonts', () => (
44+
gulp.task("fonts", () => (
5745
gulp.src("./src/fonts/**/*")
5846
.pipe(flatten())
5947
.pipe(gulp.dest("./dist/fonts"))
@@ -67,11 +55,11 @@ function runServer() {
6755
baseDir: "./dist"
6856
}
6957
});
70-
gulp.watch("./src/js/**/*.js", ["js"]);
71-
gulp.watch("./src/css/**/*.css", ["css"]);
72-
gulp.watch("./src/fonts/**/*", ["fonts"]);
73-
gulp.watch("./site/**/*", ["hugo"]);
74-
};
58+
gulp.watch("./src/js/**/*.js", gulp.parallel("js"));
59+
gulp.watch("./src/css/**/*.css", gulp.parallel("css"));
60+
gulp.watch("./src/fonts/**/*", gulp.parallel("fonts"));
61+
gulp.watch("./site/**/*", gulp.parallel("hugo"));
62+
}
7563

7664
/**
7765
* Run hugo and build the site
@@ -91,3 +79,15 @@ function buildSite(cb, options, environment = "development") {
9179
}
9280
});
9381
}
82+
83+
// Development tasks
84+
gulp.task("hugo", (cb) => buildSite(cb));
85+
gulp.task("hugo-preview", (cb) => buildSite(cb, hugoArgsPreview));
86+
87+
// Run server tasks
88+
gulp.task("server", gulp.series("hugo", "css", "js", "fonts", (cb) => runServer(cb)));
89+
gulp.task("server-preview", gulp.series("hugo-preview", "css", "js", "fonts", (cb) => runServer(cb)));
90+
91+
// Build/production tasks
92+
gulp.task("build", gulp.series(["css", "js", "fonts"], (cb) => buildSite(cb, [], "production")));
93+
gulp.task("build-preview", gulp.series(["css", "js", "fonts"], (cb) => buildSite(cb, hugoArgsPreview, "production")));

0 commit comments

Comments
 (0)