As I'm starting to prepare for delivering talks and presentations, I've decided to upgrade my slideshow game to use React components ๐๐โโ๏ธ
As a React developer, it's only natural to want to include real example of my work inside my presentations, and MDX makes that possible using a mix of Markdown and JSX.
But rather than building my own slideshow framework in React, I decided to utilize mdx-deck, a framework and CLI for creating MDX-powered slideshows. It makes creating slide decks as simple as writing Markdown, and provides indispensable features:
- ๐ Write presentations in markdown
- โ๏ธ Import and use React components
- ๐ Customizable themes and components
- 0๏ธโฃ Zero-config CLI
- ๐ Presenter mode
- ๐ Speaker notes
- See the demo site here
To make my presentation as accessible as possible, I opted to use Netlify to host it. However, the mdx-deck export docs are missing some key details. To deploy on Netlify, you point it to a distribution folder that all static assets get compiled to. I couldn't find that export folder in the docs, and had to hunt it down in the CLI's default Webpack configuration.
After a bit of research, I present - Deploying mdx-deck in 4 steps (or less!):
๐ Setting up your project
I just used the example MDX deck provided by in the mdx-deck repo. I copied it into a new folder, created a new git repo, and pushed it to Github.
You can clone my project to get started.
- Clone the project and add to your Github
- Add the repo to Netlify
or
โ๏ธ Netlify settings
In order to make sure our deck deploys properly using continuous integration, we have to configure Netlify to build and display our app.
Go to your Deploy Settings (under the Deploys tab in your Netlify project/repo) and add the following settings:
- Set the build script to
npm run build
- Set the deploy folder to
dist
We give Netlify a build script to run each time we make a commit to the repo. And the deploy folder is the place where mdx-deck exports the static HTML/JS version, and by pointing Netlify there it displays our deck after building.
Why Netlify? ๐คจ
I found myself in a situation where I didn't have immediate access to a development environment (Node/NPM specifically). I thought of using something like CodeSandbox, but since I was running build scripts and not just importing modules, it wasn't suitable for projects like mdx-deck.
Hosting on Netlify allows me to utilize Github as an code editor/IDE, make changes to my deck's repo, and deploy those to Netlify immediately. It gives me the power of a development environment (on a delay) in the cloud.
This way, if I need to make quick changes to my talk, I can deploy them easily through web interfaces ๐๐
See the demo site here | Source code
Hope that helps!
Ryo
References:
Top comments (0)