I am trying to render my GitHub repo on the Publisher-Subscriber module with JavaScript using GitHub pages. The gh-pages
branch looks fine. However, the mustache code does not render on my project on GitHub Pages. It looks like this :
GitHub Repository : https://github.com/ajhalthor/pubsub-application
Github Pages Repo for this project : https://ajhalthor.github.io/pubsub-application/
The GitHub Repository also has the node_modules
folder, so it should be self sufficient. Mustache, jQuery & Bootstrap are included in this folder, so there are no external links or CDNs.
Main Question : Why isn't mustache rendering even though all paths are specified relative to the project's main folder?
If you saw 404 even everything looks right, try switching https/http. The original question has the url wrong, usually you can check repo settings and found the correct url for generated site.
Solution: Verify the publishing source and published URL from your repository's settings tab. Double check that you are using the correct URL by visiting your repository's Settings, and scrolling down to the GitHub Pages section. You should see the URL where your site is published.
Not committing node_modules implies you need to list all your modules in the package. json (and package-lock. json ) as a mandatory step. This is great because you might not have the diligence to do so, and some of the npm operations might break if you don't.
For reference, npm FAQ answers your question clearly: Check node_modules into git for things you deploy, such as websites and apps. Do not check node_modules into git for libraries and modules intended to be reused. Use npm to manage dependencies in your dev environment, but not in your deployment scripts.
Github pages uses a version of Jekyll that ignores node_modules
folder by default.
According to this blog article. You can do the following:
Create an empty
.nojekyll
text file in the root of the gh-pages branch.
You can also refer to this announcement by github which talks about the update that is responsible for this behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With