Reference GitHub file in jsFiddle
Nowadays JSDelivr seems to be the best option.
This is an updated answer, since the url's have changed slightly for Github... I ran into this issue and figured it out for present day. Hopefully this helps people out finding this post recently. Example for Bootstrap Slate theme from Bootswatch:
Raw file url: https://raw2.github.com/thomaspark/bootswatch/gh-pages/slate/bootstrap.css
Remove the
2.
afterraw
: https://rawgithub.com/thomaspark/bootswatch/gh-pages/slate/bootstrap.css
That's it! :D
TLDR; Visit rawgit.com which will pop your files on a CDN straight from GitHub so you can use them.
Unfortunately none of the answers here worked for me. The rawgithub
URL didn't seem to work as the connection gets refused. So here's a full solution that did work. Firstly in GitHub you need to click the Raw
button to get the original JavaScript.
Then copy the URL from the page it takes you too. You'll notice if you try and use this directly you'll get a warning from JSFiddle.
More to the point is the browser will give you an error, e.g.:
Refused to execute script from https://raw.githubusercontent.com/nnnick/Chart.js/master/Chart.min.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
Take that URL and visit rawgit.com. This will give you a URL of the format https://rawgit.com/nnnick/Chart.js/master/Chart.min.js
which you can then use.
I've tried and tested this and it seems to work fine without issue