Updating gulpfile
This commit is contained in:
@@ -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]),
|
||||
};
|
||||
|
||||
7
blog/gulpfile.js/utils.js
Normal file
7
blog/gulpfile.js/utils.js
Normal file
@@ -0,0 +1,7 @@
|
||||
function getCurrentDir(dir) {
|
||||
var themeDir = dir.split("/");
|
||||
themeDir.pop();
|
||||
return themeDir.join("/");
|
||||
}
|
||||
|
||||
exports.getCurrentDir = getCurrentDir
|
||||
Reference in New Issue
Block a user