Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jieiku committed Oct 6, 2024
1 parent a18ab81 commit a58830c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions package_abridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a58830c

Please sign in to comment.