我是 github 和 git 页面的新手!
我有一个资产分支来存储 css、脚本、照片等文件。
为了让我的主分支(我用来“服务”页面的分支)中的一切井井有条并且没有“混乱”。
如何将脚本文件从主分支链接到我的 html 中?到目前为止,我从资产分支获得的链接都指向存储库,这对 html 来说并不好。
例如,我的资产分支中的文件BackgroundModule.js位于此处:
scripts/BackgroundModule.js
这是我的主分支的链接:
https://omarjuvera.github.io/Portfolios/
如果可能的话,我希望链接的结构如下:
https://omarjuvera.github.io/Portfolios/assets/scripts/BackgroundModule.js
同时保持每个分支完好无损
您需要链接到原始文件内容。 Github提供了该域下的实际文件内容https://raw.githubusercontent.com
我已经检查了你的 github 个人资料并准备了这个链接到 BackgroundModule.js 作为示例。
原始文件内容链接示例: https://raw.githubusercontent.com/omarjuvera/Portfolios/assets/scripts/BackgroundModule.js
html 文档中脚本的示例链接:
<script src="https://raw.githubusercontent.com/omarjuvera/Portfolios/assets/scripts/BackgroundModule.js"></script>