From 5917a0455420c4cb29524c7205d88d48adc293ca Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Mon, 16 Feb 2015 14:44:28 +0100 Subject: [PATCH] Fix embedded files generation on OS X. --- utility/embed-static.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utility/embed-static.sh b/utility/embed-static.sh index d0f1f291b..f14849680 100755 --- a/utility/embed-static.sh +++ b/utility/embed-static.sh @@ -21,8 +21,12 @@ do find . -type f \! -name \*.map \! -name bootstrap.js \! -name bootstrap-theme.css \! -name bootstrap.css | while read file do name=$(echo "${file}"|sed 's|\.\/||') - echo -n "\"$name\": []byte(\"" - gzip -9 -c "${file}" | xxd -p | tr -d '\n' | sed 's/\(..\)/\\x\1/g' + # Using printf here instead of "echo -n" because the latter doesn't work on Mac OS X: + # http://hints.macworld.com/article.php?story=20071106192548833. + printf "\"$name\": []byte(\"" + # The second newline deletion at the end is required for Mac OS X as well, + # as sed outputs a trailing newline there. + gzip -9 -c "${file}" | xxd -p | tr -d '\n' | sed 's/\(..\)/\\x\1/g' | tr -d '\n' echo "\")," echo done