Including js from raw.github.com
I can't help you with tricking IE, and I think from that angle what you are looking for is impossible (and discouraged, since that is not the purpose of Github's raw URLs).
However, you can automate committing the changes to gh-pages
and pushing to make your life easier. You can do it with a post-commit hook
to update the relevant files in the gh-pages
branch automatically. I've cooked up such a post-commit
script that watches for changes to certain files and commits them to another branch:
#!/bin/sh
WATCH_BRANCH="master"
WATCH_FILES="jquery-imask-min.js"
DEST_BRANCH="gh-pages"
# bail out if this commit wasn't made in the watched branch
THIS_BRANCH=$(git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/');
if [ "$THIS_BRANCH" != "$WATCH_BRANCH" ]; then
exit 0
fi
# only update if watched files have changed in the latest commit
CHANGED_FILES=$(git show --pretty="format:" --name-only $WATCH_BRANCH)
if $(echo "$CHANGED_FILES" | grep "^$WATCH_FILES$" -q); then
# checkout destination branch, then
# checkout latest version of each watched file and add to index
git checkout -q $DEST_BRANCH
git pull -q
SAVEIFS=$IFS
IFS=$(echo -n "|")
for file in $WATCH_FILES; do
git checkout $WATCH_BRANCH -- $file
git add $file > /dev/null
done
IFS=$SAVEIFS
# commit with a chance to edit the message, then go back to watched branch
LATEST_COMMIT=$(git rev-parse $WATCH_BRANCH)
git commit -m "Also including changes from $WATCH_BRANCH's $LATEST_COMMIT"
git push origin $DEST_BRANCH
git checkout -q $WATCH_BRANCH
fi
Note that this is a general script, though I have specified the config vars at the top for your purposes. $WATCH_FILES
can be set to a list of files delimited by braces |
such as index.html|js/jquery.js
. Paths must be specified relative to the root of the repo.
Let me know if you have any questions, and if the script helps you!
You can try using https://rawgit.com/ service. Just replace raw.github.com with rawgit.com
UPDATE
The Rawgit service (former Rawgithub) has been shutdown.
RawGit has reached the end of its useful life October 8, 2018
GitHub repositories that served content through RawGit within the last month will continue to be served until at least October of 2019. URLs for other repositories are no longer being served.
If you're currently using RawGit, please stop using it as soon as you can.
Github's raw URLs aren't designed to be a generic web host. Push that stuff off to proper host, like say pages.github.com.
Take a look at raw.githack.com. The idea of this service is inspired from rawgit.com. I just realized that using a whole framework (node.js + express.js) for such simple thing as requests proxying is overkilling, and made same stuff using nginx only.
Replace "githubusercontent" domain name chunk in your github/gist URL with "githack" and you're done!
Furthermore, it supports bitbucket.com - simply replace whole bitbucket domain with bb.githack.com
.