Getting Started
This page tells you how to get started with Slides as Code CLI and theme, including installation and basic usage.
Since Homebrew decided to merge Linuxbrew into Homebrew (see related blog post), in my opinion, with Windows Subsystem for Linux (WSL), HomeBrew becomes a de facto multi-platform package manager for additional software.
So, Homebrew can be used on Linux, macOS, and WSL.
However, there is no “best” way to install Slides as Code and its requirements on your computer. You should use the method that works best for your use case.
The sac command line is a Bash 4.x script targeting Linux, macOS, and WSL. It requires bash, coreutils, git, hugo, jq, tree and yq.
$ brew install bash coreutils git hugo jq tree yq
In order to install these tools with another method, please follow related documentation:
- bash version 4.x and above
- coreutils version 8.x and above
- git version 2.x and above
- hugo version 0.80 and above
- jq version 1.6 and above
- tree version 1.8.0 and above
- yq version 4.x and above
To download and install the latest version of sac command line, Homebrew can be used on Linux, macOS, and WSL.
$ brew install sacproj/sac/sac
When installing from the tarball, you have to decide where to install the sac script (e.g /usr/local/bin).
- Download the tarball
sac-cli.tar.gzfrom releases page. - Unpack the tarball, copy
sacandpdf.jsscripts where you decide with following tree.
├── bin
│ └── sac
└── libexec
└── pdf.js
Execute following command to check requirements.
$ sac doctor
For each tool, sac doctor command checks the presence of it and outputs OK or KO as result. You have to install missing tools in order to get sac command line to work as expected.
An alternative way of using sac command-line is to use the container image available at sacproj/sac.
It could be used with following function.
function sac() { \
docker run --rm \
-e SAC_DECK_CODE_HUGO_ARGS="--bind 0.0.0.0" \
-v $(pwd):/home/linuxbrew/sac \
-v $HOME/.sac/themes:/usr/local/share/sac/themes \
-p 1313:1313 \
-w /home/linuxbrew/sac \
-it sacproj/sac:2.0.6 sac "$@"; }
In order to install latest Slides as Code Theme, execute following command:
$ sac theme install github sacproj/sac-theme
Then, check installed themes by executing following command:
$ sac theme installed
/usr/local/share/sac/themes
└── sac
└── x.y.z
Create a new slides Deck with Slides as Code theme in my-awesome-slides directory:
$ sac deck new my-awesome-slides sac/x.y.z
Go to created repository
$ cd my-awesome-slides
Slides content can be split into multiple Markdown files.
So, create few new content files to organize your slides deck:
$ sac content new cover.md
my-awesome-slides/content/home/cover.md created
$ sac content new intro.md
my-awesome-slides/content/home/intro.md created
$ sac content new info.md
my-awesome-slides/content/home/info.md created
$ sac content new qa.md
my-awesome-slides/content/home/qa.md created
Thereby, the directory layout of your slides deck is following:
my-awesome-slides/
├── .gitignore
├── .vscode
│ └── sac.code-snippets
├── config.yaml
├── content
│ └── home
│ ├── cover.md
│ ├── info.md
│ ├── intro.md
│ └── qa.md
└── static
├── charts
├── codes
├── diagrams
├── images
├── sessions
├── sounds
└── videos
content/homedirectory contains the just created Markdown files.- Directories inside
staticwill contain elements such as images, source code used by the slides deck. config.yamlcontains the slides deck configuration (see Configuration page).sac.code.snippetscontains VS Code snippets used by selected themes (see Snippets page).
In order to code (with live update) or present your slides deck, execute following command:
$ sac deck code
See Content Source to code your presentation slides.