From a58830c4e3fdce7a7d8f1958cad0f5f55b387922 Mon Sep 17 00:00:00 2001 From: Jieiku <106644+Jieiku@users.noreply.github.com> Date: Sun, 6 Oct 2024 16:24:33 -0700 Subject: [PATCH] Cleanup --- package_abridge.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package_abridge.js b/package_abridge.js index 12230b8a..908c9be4 100644 --- a/package_abridge.js +++ b/package_abridge.js @@ -217,10 +217,10 @@ async function abridge() { fs.writeFileSync('static/manifest.min.json', out); } - abridge_bundle = bundle(js_prestyle, js_switcher, js_email_encode, js_copycode, search_library, index_format, uglyurls, false); + abridge_bundle = bundle(bpath, js_prestyle, js_switcher, js_email_encode, js_copycode, search_library, index_format, uglyurls, false); minify(abridge_bundle, 'static/js/abridge_nopwa.min.js'); - abridge_bundle = bundle(js_prestyle, js_switcher, js_email_encode, js_copycode, search_library, index_format, uglyurls, pwa); + abridge_bundle = bundle(bpath, js_prestyle, js_switcher, js_email_encode, js_copycode, search_library, index_format, uglyurls, pwa); minify(abridge_bundle, 'static/js/abridge.min.js'); // cleanup @@ -280,37 +280,37 @@ function _cpRegex(source, dest, regex) { } } -function bundle(js_prestyle, js_switcher, js_email_encode, js_copycode, search_library, index_format, uglyurls, pwa) { +function bundle(bpath, js_prestyle, js_switcher, js_email_encode, js_copycode, search_library, index_format, uglyurls, pwa) { minify_files = []; if (js_prestyle) { - minify_files.push(path.join(__dirname, 'static/js/prestyle.js')); + minify_files.push(path.join(bpath, 'static/js/prestyle.js')); } if (js_switcher) { - minify_files.push(path.join(__dirname, 'static/js/theme_button.js')); + minify_files.push(path.join(bpath, 'static/js/theme_button.js')); } if (js_email_encode) { - minify_files.push(path.join(__dirname, 'static/js/email.js')); + minify_files.push(path.join(bpath, 'static/js/email.js')); } if (js_copycode) { - minify_files.push(path.join(__dirname, 'static/js/codecopy.js')); + minify_files.push(path.join(bpath, 'static/js/codecopy.js')); } if (search_library) { if ((search_library === 'offline' || (search_library === 'elasticlunrjava' && uglyurls === true))) { minify_files.push('public/search_index.en.js'); - minify_files.push(path.join(__dirname, 'static/js/elasticlunr.min.js')); - minify_files.push(path.join(__dirname, 'static/js/searchjavaugly.js')); + minify_files.push(path.join(bpath, 'static/js/elasticlunr.min.js')); + minify_files.push(path.join(bpath, 'static/js/searchjavaugly.js')); } else if (search_library === 'elasticlunrjava') { minify_files.push('public/search_index.en.js'); - minify_files.push(path.join(__dirname, 'static/js/elasticlunr.min.js')); - minify_files.push(path.join(__dirname, 'static/js/searchjava.js')); + minify_files.push(path.join(bpath, 'static/js/elasticlunr.min.js')); + minify_files.push(path.join(bpath, 'static/js/searchjava.js')); } else if (search_library === 'elasticlunr') {//abridge default - minify_files.push(path.join(__dirname, 'static/js/elasticlunr.min.js')); - minify_files.push(path.join(__dirname, 'static/js/search.js')); + minify_files.push(path.join(bpath, 'static/js/elasticlunr.min.js')); + minify_files.push(path.join(bpath, 'static/js/search.js')); } else if (search_library === 'pagefind') { minify_files.push(path.join(__dirname, 'static/js/pagefind_search.js')); } else if (search_library === 'tinysearch') { - minify_files.push(path.join(__dirname, 'static/js/tinysearch.js')); + minify_files.push(path.join(bpath, 'static/js/tinysearch.js')); } } if (pwa) {