javascript - node_modules 文件夹上的 Github Pages 404

标签 javascript github github-pages

我正在尝试使用 GitHub 页面使用 JavaScript 在发布者-订阅者模块上呈现我的 GitHub 存储库。 gh-pages 分支看起来不错。但是, mustache 代码不会呈现在我在 GitHub Pages 上的项目中。它看起来像这样:

enter image description here

GitHub 存储库:https://github.com/ajhalthor/pubsub-application

此项目的 Github 页面 repo :https://ajhalthor.github.io/pubsub-application/

GitHub 存储库也有 node_modules 文件夹,所以它应该是自给自足的。 Mustache、jQuery 和 Bootstrap 包含在此文件夹中,因此没有外部链接或 CDN。

主要问题:即使所有路径都相对于项目的主文件夹指定,为什么 mustache 不渲染?

最佳答案

Github pages 使用的 Jekyll 版本默认忽略 node_modules 文件夹。

根据这个blog article .您可以执行以下操作:

Create an empty .nojekyll text file in the root of the gh-pages branch.

也可以引用这个announcement by github其中讨论了负责此行为的更新。

关于javascript - node_modules 文件夹上的 Github Pages 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43481269/

相关文章:

javascript - `this` 触发事件时属于窗口对象

javascript - 在不更改不同子路径中的相同 key 对值的情况下,在嵌套的 json 对象中查找和更新

android - 如何从 android studio 发出拉取请求?

go - 你怎么知道你的 github golang repo 是否被使用了?

github-pages - 使用 github actions 和 github-pages-deploy-action 时,github 页面出现问题?

javascript - Django:序列化QuerySet并将其发送到模板以与Javascript一起使用

javascript - 将字符串转换为数字但使用 JavaScript 保留 '+'

git - 使用 NPM 打包 fork Git 存储库的 BUILT 版本的正确方法是什么?

Github Pages 为 Jekyll 站点抛出 `Page build failure`

Jekyll 和 Disqus : cannot get disqus to appear on site