Referencing a .css file in github repo as stylesheet in a .html fileLink and execute external JavaScript file hosted on GitHubDoes GitHub Pages have a shortcut way of linking to files in its git repository?Changing nodes for images in d3.js force layout graphChrome userscript is not applying remote CSS stylesheetHow to add css to my page via Git Hub raw?Download single files from GitHubDownload a single folder or directory from a GitHub repoGitHub relative link in Markdown fileSee the size of a github repo before cloning it?What's the proper way to link to a CSS file within my GitHub?Delete forked repo from GitHubLink and execute external JavaScript file hosted on GitHubHotlink resources like JavaScript files directly from GitHubCan github be used to serve XML?Setting up Github Pages from a forked repo

Non-trope happy ending?

Why is it that I can sometimes guess the next note?

How does electrical safety system work on ISS?

Stack Interview Code methods made from class Node and Smart Pointers

What is Cash Advance APR?

Is it allowed to activate the ability of multiple planeswalkers in a single turn?

Plot of a tornado shape like surface

The Digit Triangles

Strong empirical falsification of quantum mechanics based on vacuum energy density?

A Trivial Diagnosis

How can I write humor as character trait?

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

Pre-mixing cryogenic fuels and using only one fuel tank

Why does this expression simplify as such?

What features enable the Su-25 Frogfoot to operate with such a wide variety of fuels?

Did the UK lift the requirement for registering SIM cards?

What is the difference between lands and mana?

It grows, but water kills it

Biological Blimps: Propulsion

How to get directions in deep space?

Does the reader need to like the PoV character?

"It doesn't matter" or "it won't matter"?

Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?

Shouldn’t conservatives embrace universal basic income?



Referencing a .css file in github repo as stylesheet in a .html file


Link and execute external JavaScript file hosted on GitHubDoes GitHub Pages have a shortcut way of linking to files in its git repository?Changing nodes for images in d3.js force layout graphChrome userscript is not applying remote CSS stylesheetHow to add css to my page via Git Hub raw?Download single files from GitHubDownload a single folder or directory from a GitHub repoGitHub relative link in Markdown fileSee the size of a github repo before cloning it?What's the proper way to link to a CSS file within my GitHub?Delete forked repo from GitHubLink and execute external JavaScript file hosted on GitHubHotlink resources like JavaScript files directly from GitHubCan github be used to serve XML?Setting up Github Pages from a forked repo













21















I've got a repository on github with a .css file in it. Is there any way to have github serve this file in a way that I can consume it in a web page?



In other words, I'd like to be able to reference this source file at github directly, from an HTML file on my local computer or a live domain. Something like:



<link rel="stylesheet"
type="text/css"
href="http://github.com/foouser/barproject/master/xenu-is-my-lover.css"
/>


I've tried including a<link> to the "raw" source file (http://raw.github.com...), but github serves its Content-Type as text/plain, and consequently, Chrome and FF are not adding its content as CSS styles to the page—the file's data is being discarded and a warning is shown in the debugger consoles of the browsers.










share|improve this question



















  • 1





    possible duplicate of Link and execute external JavaScript file hosted on GitHub

    – Troy Alford
    Oct 24 '14 at 20:43















21















I've got a repository on github with a .css file in it. Is there any way to have github serve this file in a way that I can consume it in a web page?



In other words, I'd like to be able to reference this source file at github directly, from an HTML file on my local computer or a live domain. Something like:



<link rel="stylesheet"
type="text/css"
href="http://github.com/foouser/barproject/master/xenu-is-my-lover.css"
/>


I've tried including a<link> to the "raw" source file (http://raw.github.com...), but github serves its Content-Type as text/plain, and consequently, Chrome and FF are not adding its content as CSS styles to the page—the file's data is being discarded and a warning is shown in the debugger consoles of the browsers.










share|improve this question



















  • 1





    possible duplicate of Link and execute external JavaScript file hosted on GitHub

    – Troy Alford
    Oct 24 '14 at 20:43













21












21








21


9






I've got a repository on github with a .css file in it. Is there any way to have github serve this file in a way that I can consume it in a web page?



In other words, I'd like to be able to reference this source file at github directly, from an HTML file on my local computer or a live domain. Something like:



<link rel="stylesheet"
type="text/css"
href="http://github.com/foouser/barproject/master/xenu-is-my-lover.css"
/>


I've tried including a<link> to the "raw" source file (http://raw.github.com...), but github serves its Content-Type as text/plain, and consequently, Chrome and FF are not adding its content as CSS styles to the page—the file's data is being discarded and a warning is shown in the debugger consoles of the browsers.










share|improve this question
















I've got a repository on github with a .css file in it. Is there any way to have github serve this file in a way that I can consume it in a web page?



In other words, I'd like to be able to reference this source file at github directly, from an HTML file on my local computer or a live domain. Something like:



<link rel="stylesheet"
type="text/css"
href="http://github.com/foouser/barproject/master/xenu-is-my-lover.css"
/>


I've tried including a<link> to the "raw" source file (http://raw.github.com...), but github serves its Content-Type as text/plain, and consequently, Chrome and FF are not adding its content as CSS styles to the page—the file's data is being discarded and a warning is shown in the debugger consoles of the browsers.







github






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 15 '11 at 21:08







user979672

















asked Oct 15 '11 at 20:47









user979672user979672

77331231




77331231







  • 1





    possible duplicate of Link and execute external JavaScript file hosted on GitHub

    – Troy Alford
    Oct 24 '14 at 20:43












  • 1





    possible duplicate of Link and execute external JavaScript file hosted on GitHub

    – Troy Alford
    Oct 24 '14 at 20:43







1




1





possible duplicate of Link and execute external JavaScript file hosted on GitHub

– Troy Alford
Oct 24 '14 at 20:43





possible duplicate of Link and execute external JavaScript file hosted on GitHub

– Troy Alford
Oct 24 '14 at 20:43












5 Answers
5






active

oldest

votes


















17














GitHub repos aren't web hosting, you should push that stuff up to a service specifically designed to serve files, like pages.github.com.






share|improve this answer























  • I don't think this is true. You can host static files on github, granted web hosting is better but it can work on github pages.

    – 32423hjh32423
    Aug 2 '18 at 13:58



















61














Important: rawgit.com is shutting down. Read more about other alternatives here - https://rawgit.com/




Found something really cool. You get the raw link as: http://raw.github.com/...



Simply fetch the files from rawgit.com (or cdn.rawgit.com) instead of raw.github.com and DONE!




UPDATE:



You can also use raw.githack.com if you want to serves raw files directly from Bitbucket or GitLab






share|improve this answer




















  • 7





    Thought this was a troll until it worked...

    – SuperFamousGuy
    May 31 '13 at 16:53






  • 1





    Just what I needed to serve the proper MIME type!

    – Kevin M
    Jun 20 '13 at 20:31






  • 8





    Keep in mind that you should not use rawgithub for production code.

    – ricksmt
    Oct 11 '13 at 16:04












  • this is seriously working, thanks for this trick :)

    – Anirudha Gupta
    Oct 6 '17 at 12:17











  • Mind Blown. Private gists and repo's don't work. just as an FYI

    – Mark Carpenter Jr
    Jan 11 '18 at 19:42


















2















  • First Visit RawGit as suggested earlier

  • Next copy your file path from github into the RawGit box

  • RawGit will automatically produce two refrences to your web page

  • The Development and Production refrence

  • refrence the development link in your webpage if you are still developing

  • save/upload then reload your webpage

  • if there was no change it means your browser has saved your former refrence

  • clear your browser data then reload

  • Hope that helps?






share|improve this answer






























    1














    You have to use RawGit which, is a part of MaxCDN, serve files directly from the GitHub repository with the correct content type header.
    Full tutorial, click here






    share|improve this answer
































      0














      Check out https://gitcdn.link/ . Seems to work well.



      Rawgit.com has shut down.






      share|improve this answer






















        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7780550%2freferencing-a-css-file-in-github-repo-as-stylesheet-in-a-html-file%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        17














        GitHub repos aren't web hosting, you should push that stuff up to a service specifically designed to serve files, like pages.github.com.






        share|improve this answer























        • I don't think this is true. You can host static files on github, granted web hosting is better but it can work on github pages.

          – 32423hjh32423
          Aug 2 '18 at 13:58
















        17














        GitHub repos aren't web hosting, you should push that stuff up to a service specifically designed to serve files, like pages.github.com.






        share|improve this answer























        • I don't think this is true. You can host static files on github, granted web hosting is better but it can work on github pages.

          – 32423hjh32423
          Aug 2 '18 at 13:58














        17












        17








        17







        GitHub repos aren't web hosting, you should push that stuff up to a service specifically designed to serve files, like pages.github.com.






        share|improve this answer













        GitHub repos aren't web hosting, you should push that stuff up to a service specifically designed to serve files, like pages.github.com.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 17 '11 at 7:56









        TekkubTekkub

        22.2k22420




        22.2k22420












        • I don't think this is true. You can host static files on github, granted web hosting is better but it can work on github pages.

          – 32423hjh32423
          Aug 2 '18 at 13:58


















        • I don't think this is true. You can host static files on github, granted web hosting is better but it can work on github pages.

          – 32423hjh32423
          Aug 2 '18 at 13:58

















        I don't think this is true. You can host static files on github, granted web hosting is better but it can work on github pages.

        – 32423hjh32423
        Aug 2 '18 at 13:58






        I don't think this is true. You can host static files on github, granted web hosting is better but it can work on github pages.

        – 32423hjh32423
        Aug 2 '18 at 13:58














        61














        Important: rawgit.com is shutting down. Read more about other alternatives here - https://rawgit.com/




        Found something really cool. You get the raw link as: http://raw.github.com/...



        Simply fetch the files from rawgit.com (or cdn.rawgit.com) instead of raw.github.com and DONE!




        UPDATE:



        You can also use raw.githack.com if you want to serves raw files directly from Bitbucket or GitLab






        share|improve this answer




















        • 7





          Thought this was a troll until it worked...

          – SuperFamousGuy
          May 31 '13 at 16:53






        • 1





          Just what I needed to serve the proper MIME type!

          – Kevin M
          Jun 20 '13 at 20:31






        • 8





          Keep in mind that you should not use rawgithub for production code.

          – ricksmt
          Oct 11 '13 at 16:04












        • this is seriously working, thanks for this trick :)

          – Anirudha Gupta
          Oct 6 '17 at 12:17











        • Mind Blown. Private gists and repo's don't work. just as an FYI

          – Mark Carpenter Jr
          Jan 11 '18 at 19:42















        61














        Important: rawgit.com is shutting down. Read more about other alternatives here - https://rawgit.com/




        Found something really cool. You get the raw link as: http://raw.github.com/...



        Simply fetch the files from rawgit.com (or cdn.rawgit.com) instead of raw.github.com and DONE!




        UPDATE:



        You can also use raw.githack.com if you want to serves raw files directly from Bitbucket or GitLab






        share|improve this answer




















        • 7





          Thought this was a troll until it worked...

          – SuperFamousGuy
          May 31 '13 at 16:53






        • 1





          Just what I needed to serve the proper MIME type!

          – Kevin M
          Jun 20 '13 at 20:31






        • 8





          Keep in mind that you should not use rawgithub for production code.

          – ricksmt
          Oct 11 '13 at 16:04












        • this is seriously working, thanks for this trick :)

          – Anirudha Gupta
          Oct 6 '17 at 12:17











        • Mind Blown. Private gists and repo's don't work. just as an FYI

          – Mark Carpenter Jr
          Jan 11 '18 at 19:42













        61












        61








        61







        Important: rawgit.com is shutting down. Read more about other alternatives here - https://rawgit.com/




        Found something really cool. You get the raw link as: http://raw.github.com/...



        Simply fetch the files from rawgit.com (or cdn.rawgit.com) instead of raw.github.com and DONE!




        UPDATE:



        You can also use raw.githack.com if you want to serves raw files directly from Bitbucket or GitLab






        share|improve this answer















        Important: rawgit.com is shutting down. Read more about other alternatives here - https://rawgit.com/




        Found something really cool. You get the raw link as: http://raw.github.com/...



        Simply fetch the files from rawgit.com (or cdn.rawgit.com) instead of raw.github.com and DONE!




        UPDATE:



        You can also use raw.githack.com if you want to serves raw files directly from Bitbucket or GitLab







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 28 '18 at 16:17

























        answered Feb 13 '13 at 20:33









        Kushagra GourKushagra Gour

        2,79221319




        2,79221319







        • 7





          Thought this was a troll until it worked...

          – SuperFamousGuy
          May 31 '13 at 16:53






        • 1





          Just what I needed to serve the proper MIME type!

          – Kevin M
          Jun 20 '13 at 20:31






        • 8





          Keep in mind that you should not use rawgithub for production code.

          – ricksmt
          Oct 11 '13 at 16:04












        • this is seriously working, thanks for this trick :)

          – Anirudha Gupta
          Oct 6 '17 at 12:17











        • Mind Blown. Private gists and repo's don't work. just as an FYI

          – Mark Carpenter Jr
          Jan 11 '18 at 19:42












        • 7





          Thought this was a troll until it worked...

          – SuperFamousGuy
          May 31 '13 at 16:53






        • 1





          Just what I needed to serve the proper MIME type!

          – Kevin M
          Jun 20 '13 at 20:31






        • 8





          Keep in mind that you should not use rawgithub for production code.

          – ricksmt
          Oct 11 '13 at 16:04












        • this is seriously working, thanks for this trick :)

          – Anirudha Gupta
          Oct 6 '17 at 12:17











        • Mind Blown. Private gists and repo's don't work. just as an FYI

          – Mark Carpenter Jr
          Jan 11 '18 at 19:42







        7




        7





        Thought this was a troll until it worked...

        – SuperFamousGuy
        May 31 '13 at 16:53





        Thought this was a troll until it worked...

        – SuperFamousGuy
        May 31 '13 at 16:53




        1




        1





        Just what I needed to serve the proper MIME type!

        – Kevin M
        Jun 20 '13 at 20:31





        Just what I needed to serve the proper MIME type!

        – Kevin M
        Jun 20 '13 at 20:31




        8




        8





        Keep in mind that you should not use rawgithub for production code.

        – ricksmt
        Oct 11 '13 at 16:04






        Keep in mind that you should not use rawgithub for production code.

        – ricksmt
        Oct 11 '13 at 16:04














        this is seriously working, thanks for this trick :)

        – Anirudha Gupta
        Oct 6 '17 at 12:17





        this is seriously working, thanks for this trick :)

        – Anirudha Gupta
        Oct 6 '17 at 12:17













        Mind Blown. Private gists and repo's don't work. just as an FYI

        – Mark Carpenter Jr
        Jan 11 '18 at 19:42





        Mind Blown. Private gists and repo's don't work. just as an FYI

        – Mark Carpenter Jr
        Jan 11 '18 at 19:42











        2















        • First Visit RawGit as suggested earlier

        • Next copy your file path from github into the RawGit box

        • RawGit will automatically produce two refrences to your web page

        • The Development and Production refrence

        • refrence the development link in your webpage if you are still developing

        • save/upload then reload your webpage

        • if there was no change it means your browser has saved your former refrence

        • clear your browser data then reload

        • Hope that helps?






        share|improve this answer



























          2















          • First Visit RawGit as suggested earlier

          • Next copy your file path from github into the RawGit box

          • RawGit will automatically produce two refrences to your web page

          • The Development and Production refrence

          • refrence the development link in your webpage if you are still developing

          • save/upload then reload your webpage

          • if there was no change it means your browser has saved your former refrence

          • clear your browser data then reload

          • Hope that helps?






          share|improve this answer

























            2












            2








            2








            • First Visit RawGit as suggested earlier

            • Next copy your file path from github into the RawGit box

            • RawGit will automatically produce two refrences to your web page

            • The Development and Production refrence

            • refrence the development link in your webpage if you are still developing

            • save/upload then reload your webpage

            • if there was no change it means your browser has saved your former refrence

            • clear your browser data then reload

            • Hope that helps?






            share|improve this answer














            • First Visit RawGit as suggested earlier

            • Next copy your file path from github into the RawGit box

            • RawGit will automatically produce two refrences to your web page

            • The Development and Production refrence

            • refrence the development link in your webpage if you are still developing

            • save/upload then reload your webpage

            • if there was no change it means your browser has saved your former refrence

            • clear your browser data then reload

            • Hope that helps?







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 16 '14 at 13:46









            Toye_BrainzToye_Brainz

            857




            857





















                1














                You have to use RawGit which, is a part of MaxCDN, serve files directly from the GitHub repository with the correct content type header.
                Full tutorial, click here






                share|improve this answer





























                  1














                  You have to use RawGit which, is a part of MaxCDN, serve files directly from the GitHub repository with the correct content type header.
                  Full tutorial, click here






                  share|improve this answer



























                    1












                    1








                    1







                    You have to use RawGit which, is a part of MaxCDN, serve files directly from the GitHub repository with the correct content type header.
                    Full tutorial, click here






                    share|improve this answer















                    You have to use RawGit which, is a part of MaxCDN, serve files directly from the GitHub repository with the correct content type header.
                    Full tutorial, click here







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Dec 15 '16 at 19:33

























                    answered Jan 9 '16 at 19:02









                    Vishal ChopraVishal Chopra

                    16128




                    16128





















                        0














                        Check out https://gitcdn.link/ . Seems to work well.



                        Rawgit.com has shut down.






                        share|improve this answer



























                          0














                          Check out https://gitcdn.link/ . Seems to work well.



                          Rawgit.com has shut down.






                          share|improve this answer

























                            0












                            0








                            0







                            Check out https://gitcdn.link/ . Seems to work well.



                            Rawgit.com has shut down.






                            share|improve this answer













                            Check out https://gitcdn.link/ . Seems to work well.



                            Rawgit.com has shut down.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 8 at 0:00









                            SquirrlSquirrl

                            1,46252858




                            1,46252858



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7780550%2freferencing-a-css-file-in-github-repo-as-stylesheet-in-a-html-file%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                                Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                                2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived