0

I want to serve a javascript file using github pages because using a CDN is too slow (it doesn't update immediately when there is a new version of the file). Is there a way to serve a javascript file instead of index.html when someone access my github pages url? Or alternatively is there a way such that index.html returns a javascript file as response instead of the usual html content?

3
  • /use/a/suburl/maybe.js? Commented Jul 16, 2017 at 11:54
  • @Jonasw I tried pushing a file.txt to an existing github page, but when I try to access (github page url)/file.txt it says file isn't found. It might be because it's not yet updated. In my experience index.html gets updated fast enough that's why I want to use index.html to make the updates reflect faster Commented Jul 16, 2017 at 11:58
  • if you want to update fast, rent your own server. Commented Jul 16, 2017 at 12:05

2 Answers 2

1

I think you can use the "raw" version link of the file. You get this link when you click on the "RAW" button.

Example:

GitHub File:

https://github.com/jquery/jquery/blob/master/src/core.js

Raw Link:

https://raw.githubusercontent.com/jquery/jquery/master/src/core.js
Sign up to request clarification or add additional context in comments.

Comments

0

You can also use a Github Gist version. This is a good option for single files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.