blob: dd09946df8fed5dd10c7eebf0fd98aeec3945cc5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
+++
title = "Custom theme example presentation"
outputs = ["Reveal"]
[reveal_hugo]
custom_theme = "custom-theme.scss"
custom_theme_compile = true
+++
## 🖌 ️
## Custom Themes
*with Hugo Pipes*
---
This presentation uses a custom Reveal.js theme written in SCSS that is compiled by Hugo, using [Hugo pipes](https://gohugo.io/hugo-pipes/).
---
Hugo pipes compiles the source code of the theme, located in `assets/custom-theme.scss`, into CSS.
---
## 😄
No separate build process is required, which means you can iterate on your theme and your content at the same time.
---
To set a custom theme and use Hugo to compile it:
```toml
[reveal_hugo]
custom_theme = "custom-theme.scss"
custom_theme_compile = true
```
`custom-theme.scss` must live in the `assets` folder.
---
To pass compilation options, use the `custom_theme_options` param:
```toml
[reveal_hugo.custom_theme_options]
targetPath = "css/custom-theme.css"
enableSourceMap = true
```
See all the [available options](https://gohugo.io/hugo-pipes/scss-sass/#options).
---
Note: to use a custom theme that doesn't need compilation, put it in the `static` directory and do not set the `custom_theme_compile` parameter. It will be served to the browser directly.
---
Write a custom Reveal.js theme in four steps:
```text
1. Import `mixins` and `settings` from the templates directory
2. Override variables and functions for colors, fonts and sizes
3. Import `theme` from the templates directory
4. Add any additional selectors to override the built CSS
```
---
See the [Reveal.js theme docs](https://github.com/hakimel/reveal.js/blob/master/css/theme/README.md) to learn what overrides are possible.
---
See `assets/custom-theme.scss` or any file in `assets/reveal-js/css/theme/source` for an example.
|