Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 268
anjanesh Avatar asked Jan 08 '12 16:01

anjanesh


People also ask

How do I save RAW files from GitHub?

Downloading a Single File From The Github Website You can copy/paste from here, but in most browsers, you should be able to right click and select “Save As” to download the file directly. For code files, it may try to save as . txt , which you will need to fix manually before or after downloading.


1 Answers

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

like image 115
Shane Gadsby Avatar answered Sep 24 '22 00:09

Shane Gadsby