From d7a834c523e517b1f11c432ccbc9f46e96bdc1c0 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Thu, 27 Jun 2024 09:00:44 -0700 Subject: allow passing arguments to zola via npm node script --- package_abridge.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'package_abridge.js') diff --git a/package_abridge.js b/package_abridge.js index 20866dc..ec1a761 100644 --- a/package_abridge.js +++ b/package_abridge.js @@ -34,6 +34,10 @@ const pwa_TTL_EXEMPT = data.extra.pwa_TTL_EXEMPT; const pwa_cache_all = data.extra.pwa_cache_all; const pwa_BASE_CACHE_FILES = data.extra.pwa_BASE_CACHE_FILES; +// This is used to pass arguments to zola via npm, for example: +// npm run abridge -- "--base-url https://abridge.pages.dev" +const args = (' '+process.argv[2] || ''); + async function execWrapper(cmd) { const { stdout, stderr } = await execPromise(cmd); if (stdout) { @@ -60,7 +64,7 @@ async function abridge() { } console.log('Zola Build to generate files for minification:'); - await execWrapper('zola build'); + await execWrapper('zola build'+args); //check that static/js exists, do this after zola build, it will handle creating static if missing. var jsdir = 'static/js'; @@ -215,7 +219,7 @@ async function abridge() { minify(abridge_bundle,'static/js/abridge.min.js'); console.log('Zola Build to generate new integrity hashes for the previously minified files:'); - await execWrapper('zola build'); + await execWrapper('zola build'+args); } function bundle(bpath,js_prestyle,js_switcher,js_email_encode,js_copycode,search_library,index_format,uglyurls,pwa) { -- cgit v1.3.1