Skip to content

Instantly share code, notes, and snippets.

@spalger
Last active November 14, 2015 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spalger/6f23abe8c63aa0737a50 to your computer and use it in GitHub Desktop.
Save spalger/6f23abe8c63aa0737a50 to your computer and use it in GitHub Desktop.
Patch Sonarr static files so that they load properly on iOS, which interestingly loads the templates file for both the runtime and the templates...
#!/usr/bin/env bash
set -e
cd ~/apps/NzbDrone/UI;
all="handlebars.combined.js"
runtime="handlebars.runtime.js"
tmpl="templates.js"
#####
## cleanup previous runs
#####
[ -f "$all" ] && rm "$all";
[ -f "$runtime.backup" ] && mv -f "$runtime.backup" "$runtime";
[ -f "$tmpl.backup" ] && mv -f "$tmpl.backup" "$tmpl";
####
## Go!
####
echo "
(function (root) {
// eject, previous combined libraries already loaded
if (root.Handlebars) return;
$(cat "$runtime")
$(cat "$tmpl")
}.call(this, this));
" > "$all";
mv "$runtime" "$runtime.backup";
mv "$tmpl" "$tmpl.backup";
cp "$all" "$runtime";
cp "$all" "$tmpl";
cd - > /dev/null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment