Skip to content

Latest commit

 

History

History
101 lines (66 loc) · 3.62 KB

File metadata and controls

101 lines (66 loc) · 3.62 KB

Generate a preview

Learn how to generate a local site preview, so you can see how your work would look on Braze Docs.

Generating the preview

Step 1: Checkout a branch

In your terminal, check out a branch to use for your site preview.

git checkout BRANCH_NAME

Replace 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-swift

Step 2: Start a local server

When 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 rake

Note

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
...

Step 3: Open your site preview

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.

An example site preview running in a web browser.

Step 4: Stop your local server

To stop your local server, reopen the terminal and press Control + C.

Updating the preview

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 _includes directory is edited

To see these updates, you'll need to stop your local server and start it again.