Fixed gulpfile for version 4
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
66
gulpfile.js
66
gulpfile.js
@ -51,7 +51,7 @@ gulp.task("build:styles:critical", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Builds all styles.
|
// Builds all styles.
|
||||||
gulp.task("build:styles", ["build:styles:main", "build:styles:critical"]);
|
gulp.task("build:styles", gulp.series("build:styles:main", "build:styles:critical"));
|
||||||
|
|
||||||
gulp.task("clean:styles", function (callback) {
|
gulp.task("clean:styles", function (callback) {
|
||||||
del([paths.jekyllCssFiles + "main.css",
|
del([paths.jekyllCssFiles + "main.css",
|
||||||
@ -101,7 +101,7 @@ gulp.task("clean:scripts:leaflet", function(callback) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Builds all scripts.
|
// Builds all scripts.
|
||||||
gulp.task("build:scripts", ["build:scripts:global", "build:scripts:leaflet"]);
|
gulp.task("build:scripts", gulp.series("build:scripts:global", "build:scripts:leaflet"));
|
||||||
|
|
||||||
// Optimizes and copies image files.
|
// Optimizes and copies image files.
|
||||||
gulp.task("build:images", function () {
|
gulp.task("build:images", function () {
|
||||||
@ -150,53 +150,53 @@ gulp.task("clean:jekyll", function(callback) {
|
|||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("clean", ["clean:jekyll",
|
gulp.task("clean", gulp.series("clean:jekyll",
|
||||||
"clean:images",
|
"clean:images",
|
||||||
"clean:scripts",
|
"clean:scripts",
|
||||||
"clean:styles"]);
|
"clean:styles"));
|
||||||
|
|
||||||
// Builds site anew.
|
// Builds site anew.
|
||||||
gulp.task("build", function (callback) {
|
gulp.task("build", function (callback) {
|
||||||
runSequence("clean",
|
gulp.series("clean",
|
||||||
["build:scripts", "build:images", "build:styles"],
|
gulp.series("build:scripts", "build:images", "build:styles"),
|
||||||
"build:jekyll",
|
"build:jekyll");
|
||||||
callback);
|
callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Builds site anew using test config.
|
// Builds site anew using test config.
|
||||||
gulp.task("build:test", function (callback) {
|
gulp.task("build:test", function (callback) {
|
||||||
runSequence("clean",
|
gulp.series("clean",
|
||||||
["build:scripts", "build:images", "build:styles"],
|
gulp.series("build:scripts", "build:images", "build:styles"),
|
||||||
"build:jekyll:test",
|
"build:jekyll:test");
|
||||||
callback);
|
callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Builds site anew using local config.
|
// Builds site anew using local config.
|
||||||
gulp.task("build:local", function (callback) {
|
gulp.task("build:local", function (callback) {
|
||||||
runSequence("clean",
|
gulp.series("clean",
|
||||||
["build:scripts", "build:images", "build:styles"],
|
gulp.series("build:scripts", "build:images", "build:styles"),
|
||||||
"build:jekyll:local",
|
"build:jekyll:local");
|
||||||
callback);
|
callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Default Task: builds site.
|
// Default Task: builds site.
|
||||||
gulp.task("default", ["build"]);
|
gulp.task("default", gulp.series("build"));
|
||||||
|
|
||||||
// Special tasks for building and then reloading BrowserSync.
|
// Special tasks for building and then reloading BrowserSync.
|
||||||
gulp.task("build:jekyll:watch", ["build:jekyll:local"], function(callback) {
|
gulp.task("build:jekyll:watch", gulp.series("build:jekyll:local", function (callback) {
|
||||||
browserSync.reload();
|
browserSync.reload();
|
||||||
callback();
|
callback();
|
||||||
});
|
}));
|
||||||
|
|
||||||
gulp.task("build:scripts:watch", ["build:scripts"], function(callback) {
|
gulp.task("build:scripts:watch", gulp.series("build:scripts", function (callback) {
|
||||||
browserSync.reload();
|
browserSync.reload();
|
||||||
callback();
|
callback();
|
||||||
});
|
}));
|
||||||
|
|
||||||
// Static Server + watching files.
|
// Static Server + watching files.
|
||||||
// Note: passing anything besides hard-coded literal paths with globs doesn't
|
// Note: passing anything besides hard-coded literal paths with globs doesn't
|
||||||
// seem to work with gulp.watch().
|
// seem to work with gulp.watch().
|
||||||
gulp.task("serve", ["build:local"], function() {
|
gulp.task("serve", gulp.series("build:local", function () {
|
||||||
|
|
||||||
browserSync.init({
|
browserSync.init({
|
||||||
server: paths.siteDir,
|
server: paths.siteDir,
|
||||||
@ -207,37 +207,37 @@ gulp.task("serve", ["build:local"], function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Watch site settings.
|
// Watch site settings.
|
||||||
gulp.watch(["_config.yml"], ["build:jekyll:watch"]);
|
gulp.watch(["_config.yml"], gulp.series("build:jekyll:watch"));
|
||||||
|
|
||||||
// Watch .scss files; changes are piped to browserSync.
|
// Watch .scss files; changes are piped to browserSync.
|
||||||
gulp.watch("_assets/styles/**/*.scss", ["build:styles"]);
|
gulp.watch("_assets/styles/**/*.scss", gulp.series("build:styles"));
|
||||||
|
|
||||||
// Watch .js files.
|
// Watch .js files.
|
||||||
gulp.watch("_assets/js/**/*.js", ["build:scripts:watch"]);
|
gulp.watch("_assets/js/**/*.js", gulp.series("build:scripts:watch"));
|
||||||
|
|
||||||
// Watch image files; changes are piped to browserSync.
|
// Watch image files; changes are piped to browserSync.
|
||||||
gulp.watch("_assets/img/**/*", ["build:images"]);
|
gulp.watch("_assets/img/**/*", gulp.series("build:images"));
|
||||||
|
|
||||||
// Watch posts.
|
// Watch posts.
|
||||||
gulp.watch("_posts/**/*.+(md|markdown|MD)", ["build:jekyll:watch"]);
|
gulp.watch("_posts/**/*.+(md|markdown|MD)", gulp.series("build:jekyll:watch"));
|
||||||
|
|
||||||
// Watch drafts if --drafts flag was passed.
|
// Watch drafts if --drafts flag was passed.
|
||||||
if (module.exports.drafts) {
|
if (module.exports.drafts) {
|
||||||
gulp.watch("_drafts/*.+(md|markdown|MD)", ["build:jekyll:watch"]);
|
gulp.watch("_drafts/*.+(md|markdown|MD)", gulp.series("build:jekyll:watch"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch html and markdown files.
|
// Watch html and markdown files.
|
||||||
gulp.watch(["**/*.+(html|md|markdown|MD)", "!_site/**/*.*"], ["build:jekyll:watch"]);
|
gulp.watch(["**/*.+(html|md|markdown|MD)", "!_site/**/*.*"], gulp.series("build:jekyll:watch"));
|
||||||
|
|
||||||
// Watch RSS feed XML files.
|
// Watch RSS feed XML files.
|
||||||
gulp.watch("**.xml", ["build:jekyll:watch"]);
|
gulp.watch("**.xml", gulp.series("build:jekyll:watch"));
|
||||||
|
|
||||||
// Watch data files.
|
// Watch data files.
|
||||||
gulp.watch("_data/**.*+(yml|yaml|csv|json)", ["build:jekyll:watch"]);
|
gulp.watch("_data/**.*+(yml|yaml|csv|json)", gulp.series("build:jekyll:watch"));
|
||||||
|
|
||||||
// Watch favicon.png.
|
// Watch favicon.png.
|
||||||
gulp.watch("favicon.png", ["build:jekyll:watch"]);
|
gulp.watch("favicon.png", gulp.series("build:jekyll:watch"));
|
||||||
});
|
}));
|
||||||
|
|
||||||
// Updates Ruby gems
|
// Updates Ruby gems
|
||||||
gulp.task("update:bundle", function () {
|
gulp.task("update:bundle", function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user