Created
August 29, 2012 22:43
-
-
Save gjtorikian/3519845 to your computer and use it in GitHub Desktop.
Wraps a chunk of text in Javascript, to support CORS and CLoud9 IDE external plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# original here: https://github.com/lennartcl/cloud9-hello-plugin/blob/master/wrap-in-js.sh | |
if [ $# == 0 ]; then | |
echo No files specified | |
exit 1 | |
fi | |
for F in $*; do | |
echo -n '// Wrapped in JavaScript, to avoid cross-origin restrictions, created using wrap-in-js.sh | |
define(function() { | |
return ' > "$F".js | |
cat "$F" | sed 's/\\/\\\\/g;'" s/'/\\\\'/g; s/^/'/g; s/$/\\\\n' +/g" >> "$F".js | |
echo "'';});" >> "$F".js | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment