From b1831175600898cc3d7347fe1d97dd28c48572e0 Mon Sep 17 00:00:00 2001 From: Daniel Tomlinson Date: Wed, 3 Jun 2020 04:39:05 +0100 Subject: [PATCH] Updating gulpfile --- blog/gulpfile.js/index.js | 14 ++++++++++++-- blog/gulpfile.js/utils.js | 7 +++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 blog/gulpfile.js/utils.js diff --git a/blog/gulpfile.js/index.js b/blog/gulpfile.js/index.js index 9553fd2..e25c08a 100644 --- a/blog/gulpfile.js/index.js +++ b/blog/gulpfile.js/index.js @@ -2,7 +2,8 @@ const { run } = require("./build-lunrjs-index"); const gulp = require("gulp"); const util = require("util"); const execFile = util.promisify(require("child_process").execFile); -// const execFile = require("child_process").execFile; +const exec = util.promisify(require("child_process").exec); +const { getCurrentDir } = require("./utils"); async function buildSearch(cb) { return run(); @@ -12,8 +13,17 @@ async function buildHugo(cb) { await execFile("hugo", ["-D", "--minify"]); } +async function buildTheme(cb) { + var themeDir = getCurrentDir(__dirname) + "/themes/panaetius-theme"; + console.log(themeDir); + await exec( + `cd ${themeDir} && node ${themeDir}/node_modules/webpack/bin/webpack.js --config ${themeDir}/webpack.prod.js` + ); +} + module.exports = { buildSearch: buildSearch, buildHugo: buildHugo, - buildBlog: gulp.parallel([buildSearch, buildHugo]), + buildTheme: buildTheme, + buildBlog: gulp.parallel([buildSearch, buildHugo, buildTheme]), }; diff --git a/blog/gulpfile.js/utils.js b/blog/gulpfile.js/utils.js new file mode 100644 index 0000000..655579e --- /dev/null +++ b/blog/gulpfile.js/utils.js @@ -0,0 +1,7 @@ +function getCurrentDir(dir) { + var themeDir = dir.split("/"); + themeDir.pop(); + return themeDir.join("/"); +} + +exports.getCurrentDir = getCurrentDir