Tailwind css 站点无法在 github 页面上运行

问题描述 投票:0回答:1

我使用 Tailwind CSS 克隆了 FB 登录页面,它在我的本地计算机上运行良好,但是当我将其部署到 GitHub 页面时,它显示错误。

它在 Netlify 上运行良好,但在 GitHub 页面上出现错误 这是链接 [these are the errors

css tailwind-css github-pages
1个回答
0
投票

您的 GitHub Pages 站点位于 URL

https://gayatri-tech.github.io/FbLoginPage
,位于主主机名
https://gayatri-tech.github.io/
的子路径中。

index.html
中,CSS 通过值
/src/output.css
引用,该值解析为
https://gayatri-tech.github.io/src/output.css
。但是,您的存储库中的文件将位于
https://gayatri-tech.github.io/FbLoginPage/src/output.css
,因此会出现 404 未找到错误。

要解决此问题,您可以考虑通过删除第一个斜杠 (

/
) 来使路径引用成为相对路径:

<link rel="stylesheet" href="src/output.css" />

favicon 参考的分辨率相同:

<link rel="icon" type="image/x-icon" href="fb_icon.png" />
© www.soinside.com 2019 - 2024. All rights reserved.