Yeoman generator for Reveal.js
A Yeoman generator for the awesome Reveal.js presentation framework.
Install:
npm install -g generator-reveal
Make a new directory, and
cdinto it:
mkdir my-new-project && cd $_
Run
yo revealand start building your presentation.
After all files are created you can view your slides with
grunt:
grunt serve
Then, create further slides with
yo reveal:slide more-content. See below for available options. When you want to export your presentation to some static HTML server, you can type
grunt distto have all your relevant files saved to the
distdirectory.
If you are checking out an existing presentation to do some work on it, make sure to install the required dependencies:
cd my-existing-project npm install && bower install
Now you should be able to view the slides again with
grunt:
grunt serve
Available generators:
Generates a Slide file.
Example:
bash yo reveal:slide "Slide Title"
Produces
slides/slide-title.html:
Slide Title
This is a new slide
And the slide filename will be added to your
slides/list.jsonfile.
[ "index.md", "slide-title.html" ]
In order to add vertical slides, you can nest an array inside
slides/list.json
[ "index.md", [ "vertical-html.html", "vertical-markdown.md" ], [ "vertical-html-2.html", "vertical-markdown-2.md" ], "the-end.md" ]
Sometimes you just want a slide with a background image. That's okay, a slide object does not need a filename.
[ "index.md", { "attr": { "data-background": "http://example.com/image.png" } } ]
Invoked with
--markdown
yo reveal:slide "Slide Title" --markdown
Produces
slides/slide-title.md
## Slide TitleThis is a new slide
Invoked with
--attributes
yo reveal:slide "Slide Title" --attributes
adds a slide
Objectwith an
attrkey to your
slides/list.jsonfile. Attributes will be passed to
sectionelement containing the slide.
[ "index.md", { "filename": "slide-title.md", "attr": { "data-background": "#ff0000" } } ]
Invoked with
--notes
yo reveal:slide "Slide Title" --notes
Produces
slides/slide-title.html:
Slide Title
This is a new slide
All three options maybe combined, e.g.
yo reveal:slide "Markdown Slide With Notes And Section-Attributes" --notes --attributes --markdown
If your presentation requires specific resources that you would like included with your project, place them in the resources directory. These assets will be included in the distribution and available for access at the path
resources/asset_name.ext.
With the help of Grunt Build Control,
generator-revealcan deploy your presentation to Github Pages easily. All you have to do is
yo reveal
grunt deploy
If everything goes right,
grunt deploywill build and push your presentation to a gh-pages git branch. Just give it a couple of minutes, fire up a browser and go to http://username.github.io/repositoryname to see your brand new presentation.
To change the options of the whole presentation, such as the theme used, transition effect etc. consult the Reveal.js documentation. An important difference, though, is that you should not edit the
index.htmlfile directly as it gets overwritten as you add presentation content whenever a new grunt build is triggered. You should instead edit the
templates/_index.htmlfile, which is used as a template for the automatically generated
index.html.
The generated presentation app includes the Highlight.js Syntax Themes as a dependency, allowing you to change the syntax theme.
The available syntax themes can be found in the
bower_components/highlightjs/stylesfolder. Selecting a new syntax theme can be done by changing the stylesheet reference in the
templates/_index.htmlfile: