Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I have a GitHub project with a CSS file and I want a HTML page to be able to pull this in so I created a GitHub pages branch and synced everything over.

The file is included as such:

<link href="https://raw.github.com/dublintech/JavaScript_Examples/gh-pages/jsquiz/css/jquiz.css" type="text/css" rel="stylesheet">

But in Firebug I am getting the following error:

The stylesheet https://raw.github.com/dublintech/JavaScript_Examples/gh-pages/jsquiz/css/jquiz.css was not loaded because its MIME type, "text/plain", is not "text/css".

So I still get wrong MIME type. Any ideas what I am doing wrong?

share|improve this question

1 Answer 1

This is by design as you should not be serving or linking to raw files in this manner.

It could also be seen as abuse of their services as linking to the raw file is using GitHub as a content delivery network (CDN).

Instead, you need to make use of the GitHub Pages feature and link to the file from there. Which, when you build your pages will be along the lines of:

<link rel="stylesheet" href="http://repo-owner.github.com/repo/css/style.css">

In your case, it would be here:

<link rel="stylesheet" href="http://dublintech.github.com/JavaScript_Examples/jsquiz/css/jquiz.css">

And when it is referenced from the correct location, it will be served as text/css as expected/wanted.

share|improve this answer
    
This is a better way as it does prevent link rotting, though you have to manually update it if the original copy is changed on the master branch on the repository. –  Hydra Jan 28 '13 at 10:01
    
Another option is to just get rid of the master and work solely from the gh-pages branch - oli.jp/2011/github-pages-workflow –  Mottie Nov 25 '13 at 21:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.