Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions scripts/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,29 @@
# run this script from the project root using `./scripts/build_docs.sh`

usage() {
echo "Usage: $0 [-b]"
echo "Usage: $0 [-b | -n]"
echo ""
echo "Build Classy Vision documentation."
echo ""
echo " -b Build static version of documentation (otherwise start server)"
echo " -n Skip the docusaurus build/start step"
echo ""
exit 1
}

BUILD_STATIC=false

while getopts 'hb' flag; do
while getopts 'hbn' flag; do
case "${flag}" in
h)
usage
;;
b)
BUILD_STATIC=true
;;
n)
SKIP_DOCUSAURUS=true
;;
*)
usage
;;
Expand Down Expand Up @@ -83,6 +87,13 @@ python scripts/parse_tutorials.py -w "${cwd}"

cd website || exit

if [[ $SKIP_DOCUSAURUS == true ]]; then
echo "-----------------------------------"
echo "Skipping docusaurus build because -n flag was provided"
echo "-----------------------------------"
exit 0
fi

if [[ $BUILD_STATIC == true ]]; then
echo "-----------------------------------"
echo "Building static site"
Expand Down
3 changes: 2 additions & 1 deletion website/core/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class Footer extends React.Component {
<script dangerouslySetInnerHTML={{__html:`
(function() {
var BAD_BASE = '/classyvision/';
if (window.location.origin !== '${this.props.config.url}') {
if (window.location.origin !== '${this.props.config.url}'
&& window.location.origin !== 'https://staticdocs.thefacebook.com') {
var pathname = window.location.pathname;
var newPathname = pathname.slice(pathname.indexOf(BAD_BASE) === 0 ? BAD_BASE.length : 1);
var newLocation = '${this.props.config.url}${this.props.config.baseUrl}' + newPathname;
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"scripts": {
"examples": "docusaurus-examples",
"start": "docusaurus-start",
"build": "docusaurus-build",
"build": "(cd .. && pwd && ./scripts/build_docs.sh -n && cd website && yarn docusaurus-build)",
"publish-gh-pages": "docusaurus-publish",
"write-translations": "docusaurus-write-translations",
"version": "docusaurus-version",
Expand Down