如何主持 reveal.js 演示
How to host a reveal.js presentation
我对所有这些网络开发都是新手(我只知道在本地做事)。我使用 reveal.js 做了一个演示,我希望能够在线看到它(例如在我的 phone 上)。我知道我应该主持它,但我真的不知道该怎么做。我尝试使用幻灯片(reveal.js 的在线编辑器)来完成它,但我无法添加脚本和此类内容(我在演示文稿中使用了 highcharts)。如果能给点建议,程序就好了。
在 GitHub
上创建一个 new 存储库
姑且称之为reveal_HelloWorld
在本地机器上克隆它:
git clone git@github.com:yourusername/reveal_HelloWorld.git
在您的本地计算机上克隆 reveal.js:
git clone git@github.com:hakimel/reveal.js.git
将 reveal.js
文件夹的内容移动到 reveal_HelloWorld
文件夹
修改index.html
文件
创建并切换到新分支
git checkout -b 'gh-pages'
推送
git push
来自 GitHub 网站 repo 设置:
- 将“gh-pages”分支设置为默认分支
- 删除‘master’分支
大功告成。
幻灯片发布于 yourusername.github.io/reveal_HelloWorld
。
来源:How to deploy Reveal.js presentations on Github
现在(2016 年 10 月)您不再需要创建特定的分支 (gh-pages)。然后创建您的存储库 select 'Settings -> Options'。有一个 'GitHub Pages' 面板,您可以在其中设置要发布为网页的任何分支。
作为一次性解决方案非常好。但是,如果用户想要在 GitHub 页面中托管多个演示文稿,则他们每次都需要重复该过程。另一种方法是使用一个 GitHub 存储库进行多个演示。
步骤如下:
- 在 GitHub 中创建一个干净的存储库(没有 README 等),比如
presentations
将 git 存储库和 link 初始化为 GitHub,在 Linux 中将是
mkdir presentations
cd presentations
git init
git remote add origin git@github.com:username/presentations.git
将reveal.js
添加为"remote"并拉取存储库
git remote add upstream git@github.com:hakimel/reveal.js.git
git pull upstream master
为您的演示文稿创建一个空分支并清理工作目录
git checkout --orphan my-fancy-presentation
git reset --hard
将演示文稿复制到当前文件夹并提交更改
cp path/to/my_fancy_presentation.html .
git add .
git commit -m 'Initial commit'
切换到 master 并在那里合并您的演示文稿
git checkout master
git merge my-fancy-presentation
将所有分支推送到GitHub
git push --all origin
设置 GitHub 个页面以分支 master
并在 https://username.github.io/presentations/my_fancy_presentation.html
欣赏您的演示文稿
现在,每当您想添加另一个演示文稿时,只需重复步骤 4-7 即可。此外,只要你想更新 reveal.js
,你可以简单地做 git pull upstream master
.
作为此方法的示例,请参阅 https://github.com/dougmvieira/presentations。
我对所有这些网络开发都是新手(我只知道在本地做事)。我使用 reveal.js 做了一个演示,我希望能够在线看到它(例如在我的 phone 上)。我知道我应该主持它,但我真的不知道该怎么做。我尝试使用幻灯片(reveal.js 的在线编辑器)来完成它,但我无法添加脚本和此类内容(我在演示文稿中使用了 highcharts)。如果能给点建议,程序就好了。
在 GitHub
上创建一个 new 存储库
姑且称之为
reveal_HelloWorld
在本地机器上克隆它:
git clone git@github.com:yourusername/reveal_HelloWorld.git
在您的本地计算机上克隆 reveal.js:
git clone git@github.com:hakimel/reveal.js.git
将
reveal.js
文件夹的内容移动到reveal_HelloWorld
文件夹修改
index.html
文件创建并切换到新分支
git checkout -b 'gh-pages'
推送
git push
来自 GitHub 网站 repo 设置:
- 将“gh-pages”分支设置为默认分支
- 删除‘master’分支
大功告成。
幻灯片发布于 yourusername.github.io/reveal_HelloWorld
。
来源:How to deploy Reveal.js presentations on Github
现在(2016 年 10 月)您不再需要创建特定的分支 (gh-pages)。然后创建您的存储库 select 'Settings -> Options'。有一个 'GitHub Pages' 面板,您可以在其中设置要发布为网页的任何分支。
步骤如下:
- 在 GitHub 中创建一个干净的存储库(没有 README 等),比如
presentations
将 git 存储库和 link 初始化为 GitHub,在 Linux 中将是
mkdir presentations cd presentations git init git remote add origin git@github.com:username/presentations.git
将
reveal.js
添加为"remote"并拉取存储库git remote add upstream git@github.com:hakimel/reveal.js.git git pull upstream master
为您的演示文稿创建一个空分支并清理工作目录
git checkout --orphan my-fancy-presentation git reset --hard
将演示文稿复制到当前文件夹并提交更改
cp path/to/my_fancy_presentation.html . git add . git commit -m 'Initial commit'
切换到 master 并在那里合并您的演示文稿
git checkout master git merge my-fancy-presentation
将所有分支推送到GitHub
git push --all origin
设置 GitHub 个页面以分支
master
并在https://username.github.io/presentations/my_fancy_presentation.html
欣赏您的演示文稿
现在,每当您想添加另一个演示文稿时,只需重复步骤 4-7 即可。此外,只要你想更新 reveal.js
,你可以简单地做 git pull upstream master
.
作为此方法的示例,请参阅 https://github.com/dougmvieira/presentations。