Skip to content

Commit cd1c6c0

Browse files
committed
Auto hot reloading with sphinx-autobuild
I have tested this on Linux. We need another dev to test the batch file on Windows. I have added this to other projects https://github.com/sphinx-doc/sphinx-autobuild https://github.com/sphinx-doc/sphinx-autobuild?tab=readme-ov-file#using-with-makefile Listed as one of the best Sphinx extensions: https://sphinx-extensions.readthedocs.io/en/latest/
1 parent 5321bbb commit cd1c6c0

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ BUILDDIR = build
1212
help:
1313
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1414

15-
.PHONY: help Makefile
15+
.PHONY: help Makefile livehtml
1616

1717
# Catch-all target: route all unknown targets to Sphinx using the new
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1919
%: Makefile
20-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+
22+
livehtml:
23+
sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

make.bat

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ set BUILDDIR=build
1212
set SPHINXPROJ=ApacheCloudStack
1313

1414
if "%1" == "" goto help
15+
REM --- Added section for 'livehtml' ---
16+
if "%1" == "livehtml" goto livehtml
17+
REM -------------------------------------
1518

1619
%SPHINXBUILD% >NUL 2>NUL
1720
if errorlevel 9009 (
@@ -29,6 +32,11 @@ rd %BUILDDIR% /q /s
2932
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
3033
goto end
3134

35+
:livehtml
36+
REM
37+
sphinx-autobuild "%SOURCEDIR%" "%BUILDDIR%" %SPHINXOPTS% %O%
38+
goto end
39+
3240
:help
3341
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
3442

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Sphinx==7.2.6
33
sphinx-rtd-theme==2.0.0
44
readthedocs-sphinx-ext==2.2.5
55
Jinja2==3.1.5
6+
sphinx-autobuild==2025.8.25

0 commit comments

Comments
 (0)