【问题标题】:Localhost on Jekyll does not render css: it only renders onlineJekyll 上的 localhost 不渲染 css:它只在线渲染
【发布时间】:2018-04-17 08:54:13
【问题描述】:

到目前为止,我一直在本地主机上构建我的网站。

在某些时候,我不得不构建一个额外的页面。但后来我注意到,在我的本地主机上进行设计时,css 没有被渲染到那个新页面(index.html 除外)。

所以我必须在路径<link href="/css/style.css" rel="stylesheet"> 中添加一个/,以便css 显示在我的新页面上并直接从根目录构建。

具有讽刺意味的是,这在我的本地主机上不起作用。这有点烦人,因为现在我无法在本地主机上设计我的网站。

为什么 Jekyll 会这样?如何在本地进行设计?

本机地址:http://127.0.0.1:4000/boilerplate/

回购链接:https://github.com/bomengeduld/boilerplate/tree/gh-pages

【问题讨论】:

标签: css localhost jekyll jekyll-bootstrap


【解决方案1】:

你的服务器地址应该是http://127.0.0.1:4000,没有'boilerplate'(或者你应该添加'boilerplate'作为你的baseurl)。

【讨论】:

  • 或者如果 OP 在子目录中添加了新的 html 文件,也许 "../css/style.css" 作为 url 会更好,因为它与他们的本地主机和服务器设置兼容。
  • 我从 config.yml 中的 baseurl 中删除了 /boilerplate/。然后我重新启动了本地主机。之后它起作用了。有时这是愚蠢的错误。谢谢大家的指导!
猜你喜欢
  • 1970-01-01
  • 2023-03-21
  • 1970-01-01
  • 1970-01-01
  • 2016-10-07
  • 2021-06-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多