Skip to content

Instantly share code, notes, and snippets.

@viegelinsch
Created November 29, 2016 14:43
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save viegelinsch/1885ad4c3f2c85b615b946b8aa5d6738 to your computer and use it in GitHub Desktop.
Save viegelinsch/1885ad4c3f2c85b615b946b8aa5d6738 to your computer and use it in GitHub Desktop.
Using reveal.js as presentation framework for learning resources

inspired by Teaching with open source presentation service Reveal.js

  1. Create a git repository (eg. on github)
  2. Clone it to your desktop _(via ssh)
git clone git@github.com:yourusername/newrepository.git
  1. change into the new directory
cd newrepository/
  1. add reveal.js as submodule and initialize
git submodule add https://github.com/hakimel/reveal.js revealjs
git submodule update --init --recursive
  1. change into the directory of the revealjs submodule and check that initialisation was successfull
cd revealjs/
git log
cd ..

(git log should show the commit messages of the original reveal.js repository)

  1. commit the addition of the submdule and push it upstream
git commit -m "added reveal.js as submodule"
git push
  1. copy the original presentation "start-file" from the submodule to the main repository
cp revealjs/index.html .
  1. edit index.html - add "revealjs" at the start of all relevant paths (css, ja, lib, plugin)
  2. commit the addition of the presentation "start-file" and push it upstream
git commit -m "adding file for presentation/content"
git push
@ratnanil
Copy link

Thank you for this! Just a quick question: How do I start a local webserver to preview my outout when some files are in revealjs/* and index.html is one directory above?

@viegelinsch
Copy link
Author

Well, to be honest, that would be a bigger story.
I usually use only the preview in a browser as this comes closest to serving the presentation later with an old-school httpd or nginx.
You need to move the gulpfile.js and the package.json one level up and adjust the paths.

@ratnanil
Copy link

Thanks for your response! I just found out that instead of npm start, I can use live-server, installable via npm.

@ratnanil
Copy link

Another question: Can submodules be used when working with Plugins? This would require some sort of nesting of git repositories, is this possible?

my_revealjs_slides/
├── revealjs                  # added as a submodule from hakimel/reveal.js
│   ├── css
│   ├── dist
│   ├── js
│   ├── plugin
│        ├── highlight         # a default plugin included in hakimel/reveal.js
│        ├── ....              # further plugins included in hakimel/reveal.js
│        ├── helpbutton        # added as a submodule from McShelby/reveal-helpbutton

@viegelinsch
Copy link
Author

For me it works fine as I add the plugins as submodule as well.

@ratnanil
Copy link

@viegelinsch: So you add plugins as subfolders of revealjs? Could you share your git commands?

Are you doing the following?

git submodule add https://github.com/hakimel/reveal.js revealjs
git submodule update --init --recursive
git submodule add https://github.com/McShelby/reveal-helpbutton revealjs/plugins/helpbutton

@viegelinsch
Copy link
Author

I traverse into the plugin directory and add the submodule there but your last command should work as well.

@ratnanil
Copy link

ratnanil commented Jul 8, 2022

strangely, it doesn't:

$ git submodule add https://github.com/McShelby/reveal-helpbutton revealjs/plugins/helpbutton -f
The following path is ignored by one of your .gitignore files:
revealjs/plugins/helpbutton
Use -f if you really want to add it.

using -f leads to this:

$ git submodule add -f https://github.com/McShelby/reveal-helpbutton revealjs/plugins/helpbutton
error: submodule git dir '/home/nils/temp/test/.git/modules/revealjs/plugins/helpbutton' is inside git dir '/home/nils/temp/test/.git/modules/revealjs'
fatal: refusing to create/use '/home/nils/temp/test/.git/modules/revealjs/plugins/helpbutton' in another submodule's git dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment