node.js - 对 Wintersmith 中部署的开箱即用支持

标签 node.js heroku github-pages wintersmith

是否有一种自动化的方式来轻松托管由 wintersmith 制作的静态站点在 Github Pages 或 Heroku 上?

我尝试编写一个 gruntfile、shell 脚本以及此 issue 中提到的一些建议。但所有这些都很难设置。

我基本上正在寻找像这样简单的东西 -

wintersmith new myblog
npm install
wintersmith deploy

PS: 有人可以给这个问题贴上新的冬日史密斯标签吗?

最佳答案

以下是一些基于我的 github 页面设置的一般指南。 (more info on github pages)

我有两个文件夹。一个用于 Wintersmith,另一个是 git 存储库文件夹。

./myblog/ (wintersmith)
./personalblog/ (git repo)

在配置 git 存储库时,通过以下方式创建 ./personalblog/:

mkdir personalblog; cd personalblog
git init
git branch -m master gh-pages (this is important! see: https://help.github.com/articles/user-organization-and-project-pages#project-pages)

在 github 上创建同名存储库。然后设置本地仓库的来源。 See here for more info.

./myblog 中,我有一个 bash 脚本 (build.sh),其中包含以下内容:

#!/bin/sh
# ./myblog/build.sh

# other build commands such as javascript or css minifiers

rm -r ./build/
wintersmith build

然后,我检查并验证 Wintersmith 的构建。我使用 nodejs http-server 进行验证。我还有另一个用于部署的 bash 脚本文件:

#!/bin/sh
# ./myblog/deploy.sh

# rsync to efficiently sync ./myblog/build to ./personalblog/
# ignore deleteing .git folder and other stuff
rsync -rtvu --delete -f"- .git/" -f"- CNAME" -f"- .gitignore" -f"- README.md" ./build/ ../personalblog/


# change dir
cd ../personalblog/

# sync to github
git add -A
git commit -am "Commit on $(date)"
git push origin gh-pages

希望这些指南对您有所帮助。

关于node.js - 对 Wintersmith 中部署的开箱即用支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18762081/

相关文章:

angularjs - AngularJS 的 SEO 托管在 github 页面

Node.js 应用程序在本地工作,但 heroku 说缺少模块

angular - 如何发布到github页面?

javascript - 在 React 的父组件中使用按钮提交表单

node.js - 使用 Node JS 验证 jwt token 和代理到另一台服务器

node.js - Heroku Node + React 应用程序 : anchor tag auth request unhandled

ruby-on-rails - 如何将 React 应用程序和 Rails API 部署到 Heroku?

github-pages - Github Pages 404除了index.html以外的所有内容

angularjs - 前端模板与后端模板

node.js - 在 NodeJS 中处理长时间运行的进程?