Github pages reference file from project repo
Github pages reference file from project repo
I'm trying to create Github project pages which use the actual repo's contents.
main project: github.com/me/project
github.com/me/project/css.css
...
project pages: github.com/me/project/docs/
github.com/me/project/docs/index.html
I assumed the point of keeping pages in docs/
is being able to reference the files in the actual repo.
docs/
Is this even possible? How would I use github.com/me/project/css.css
from github.com/me/project/docs/index.html
?
github.com/me/project/css.css
github.com/me/project/docs/index.html
Edit: I am aware of rawgit.com, but I'd like a native Github solution.
1 Answer
1
There's an incredibly simple solution when using the gh-pages
branch:
gh-pages
Say we have an image "img.png"
in assets
branch root directory, we can use it from another branch like so
"img.png"
assets
<img src="../assets/img.png">
Update September 2018: Does not work any longer.
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.