Learn how to generate a local site preview, so you can see how your work would look on Braze Docs.
In your terminal, check out a branch to use for your site preview.
git checkout BRANCH_NAMEReplace BRANCH_NAME with the name of one of your branches or another person's branch. Your command should be similar to the following:
git checkout BD-2346-fixing-typo-swiftWhen you start a local server, the files in your current branch are used to you build a local preview of Braze Docs. To start a local server using your current branch, run the following command in your braze-docs directory.
# for 'en' language:
rake
# for other languages:
rake es
rake fr
rake ja
rake ko
rake pt_br
# Partner hub: Sanity fetch runs by default when `partner_api: true` in `_config.yml`.
# Skip with: PARTNER_API=false rake
# to render content in '{% markdown_embed %}' tags (e.g. Developer Guide changelogs):
MARKDOWN_API=true rakeNote
Prepending MARKDOWN_API=true to your rake command lets you preview content within a {% markdown_embed %} tag, such as the content on the Developer Guide: Changelogs page. Technology Partners hub tiles load from Sanity when partner_api is enabled in _config.yml (the default). Use PARTNER_API=false to skip that request.
The output will be similar to the following:
== Sinatra (v3.0.4) has taken the stage on 4000 for development with backup from Puma
Puma starting in single mode...
* Puma version: 6.3.1 (ruby 3.2.2-p225) ("Mugi No Toki Itaru")
* Min threads: 8
* Max threads: 32
* Environment: development
* PID: 16158
* Listening on http://127.0.0.1:4000
...By default, your site preview will be generated on localhost http://127.0.0.1:4000. To open your site preview, open the link in your web browser.
To stop your local server, reopen the terminal and press Control + C.
In most cases, your site preview will update automatically when you make changes to the files in braze-docs. When this happens, your terminal will output a message similar to the following:
Asset Pipeline: Processing 'javascript_asset_tag' manifest 'global'
Asset Pipeline: Saved 'global-128fd02b54e35ea79fcb21ea460fac06.js' to '/Users/alex-lee/braze-docs/_site/assets'
...done in 1.940883 seconds.To see these updates in your browser, refresh the page.
Tip
You can refresh the page in your browser by pressing Command + R on macOS, or Control + R on Windows.
However, there are cases when your site preview will not be automatically updated, such as when:
- A file or directory name is changed
- A new file or directory is added
- The content of a file in the
_includesdirectory is edited
To see these updates, you'll need to stop your local server and start it again.
