Skip to content

Commit

Permalink
Only minify manifest.json if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Jieiku committed Sep 9, 2023
1 parent 5e55301 commit 9c6f4e0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions package_abridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,15 @@ if (bpath === '') {// abridge used directly
}

// Minify the json manifest
let out;
try {
out = JSON.minify(fs.readFileSync('static/manifest.json', {encoding:"utf-8"}));
} catch(err) {
stdout.write(" - ❌\n\n\n");
if (fs.existsSync('static/manifest.json')) {// if manifest.json is present, then minify it.
let out;
try {
out = JSON.minify(fs.readFileSync('static/manifest.json', {encoding:"utf-8"}));
} catch(err) {
console.log(err);
}
fs.writeFileSync('static/manifest.min.json', out);
}
fs.writeFileSync('static/manifest.min.json', out);

abridge_bundle = bundle(bpath,js_prestyle,js_switcher,js_email_encode,js_copycode,search_library,index_format,uglyurls,false);
minify(abridge_bundle,bpath+'static/js/abridge_nopwa.min.js');
Expand Down

0 comments on commit 9c6f4e0

Please sign in to comment.