How to publish a website made by Node.js to Github Pages?

前端 未结 5 1624
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 16:43

I made a website using Node.js as the server. As I know, the node.js file should start working by typing commands in terminal, so I\'m not sure if Github Pages supports node

5条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 17:02

    We, the Javascript lovers, don't have to use Ruby (Jekyll or Octopress) to generate static pages in Github pages, we can use Node.js and Harp, for example:

    These are the steps. Abstract:

    1. Create a New Repository
    2. Clone the Repository

      git clone https://github.com/your-github-user-name/your-github-user-name.github.io.git
      
    3. Initialize a Harp app (locally):

      harp init _harp
      

    make sure to name the folder with an underscore at the beginning; when you deploy to GitHub Pages, you don’t want your source files to be served.

    1. Compile your Harp app

      harp compile _harp ./
      
    2. Deploy to Gihub

      git add -A
      git commit -a -m "First Harp + Pages commit"
      git push origin master
      

    And this is a cool tutorial with details about nice stuff like layouts, partials, Jade and Less.

提交回复
热议问题