Skip to content

Commit

Permalink
chore: Add script for docs preview.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubnowicki committed May 13, 2024
1 parent 1c77cf3 commit 56a5f11
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
.Ruserdata
.DS_Store
.Renviron

/.quarto/
/_site/
_quarto.yml
styles.css
3 changes: 3 additions & 0 deletions .rscignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
.Renviron
.rhino
.rscignore
build_local_docs.sh
docs
img
tests
42 changes: 42 additions & 0 deletions build_local_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# This script is used to build the local documentation for the project.

remove_files() {
if [ -f _quarto.yml ]; then
echo "Removing _quarto.yml..."
rm _quarto.yml
fi

if [ -f styles.css ]; then
echo "Removing styles.css..."
rm styles.css
fi
}

cleanup() {
echo "Cleaning up..."
remove_files
exit 1
}

trap cleanup SIGINT

if [ "$1" = "preview" ]; then
echo "Copying _quarto.yml..."
cp docs/_quarto.yml _quarto.yml
echo "Copying styles.css..."
cp docs/styles.css styles.css

echo "Building local documentation preview..."
quarto preview
elif [ "$1" = "render" ]; then
echo "Copying _quarto.yml..."
cp docs/_quarto.yml _quarto.yml
echo "Copying styles.css..."
cp docs/styles.css styles.css

echo "Rendering local documentation..."
quarto render
remove_files
fi

0 comments on commit 56a5f11

Please sign in to comment.