How to link files directly from Github (raw.github.com)

anjanesh picture anjanesh · Jan 8, 2012 · Viewed 69k times · Source

Are we allowed to link files directly from Github ?

<link rel="stylesheet" href="https://raw.github.com/username/project/master/style.css"/>
<script src="https://raw.github.com/username/project/master/script.js"></script>

I know this is allowed on Google Code. This way I don't have to worry about updating a local file.

Answer

Shane Gadsby picture Shane Gadsby · Jun 26, 2015

The great service RawGit was already mentioned, but I'll throw another into the ring: GitCDN.link

Benefits:

  • Lets you link to specific commits, as well as auto-get the latest (aka master)
  • Incurs no damage from high traffic volumes; RawGit asks that it's dev.rawgit.com links be only used during development, where as GitCDN give you access to the latest version, without the danger of the servers exploding
  • Give you the option of auto minifying your HTML, CSS and JavaScript, or serving it as written (https://min.gitcdn.link).
  • Adds compression (GZip)
  • Adds all the correct headers (Content-Type, cache-control, e-tag, etc)

Full disclosure, I'm a project maintainer at GitCDN.link