From fab45ee042af51c1e7da7394a67190f24d9c5f39 Mon Sep 17 00:00:00 2001
From: Ayush Singh <ayushdevel1325@gmail.com>
Date: Mon, 15 Jan 2024 20:50:42 +0530
Subject: [PATCH] Add support for hot-reload

- Uses sphinx-autobuild
- Helpful during development

Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
---
 Makefile                                  | 3 +++
 books/beaglebone-cookbook/11misc/misc.rst | 6 ++++++
 requirements.txt                          | 5 +++++
 3 files changed, 14 insertions(+)

diff --git a/Makefile b/Makefile
index 78a1646c..98e3ceab 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,9 @@ submodule:
 librobotcontrol:
 	cd projects/librobotcontrol/docs/ ; doxygen
 
+livehtml:
+	sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
 .PHONY: help Makefile submodule librobotcontrol
 
 # Catch-all target: route all unknown targets to Sphinx using the new
diff --git a/books/beaglebone-cookbook/11misc/misc.rst b/books/beaglebone-cookbook/11misc/misc.rst
index 2fdb0b5b..8e0e5c64 100644
--- a/books/beaglebone-cookbook/11misc/misc.rst
+++ b/books/beaglebone-cookbook/11misc/misc.rst
@@ -811,6 +811,12 @@ To preview docs on your local machine:
 
     bone$ sphinx-serve
 
+For hot reload in development:
+
+.. code-block:: bash
+
+    bone$ make livehtml
+
 Then point your browser to localhost:8081.
 
 .. tip:: 
diff --git a/requirements.txt b/requirements.txt
index 767efb55..05dcb1ee 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,19 +3,23 @@ Babel==2.13.1
 breathe==4.35.0
 certifi==2023.11.17
 charset-normalizer==3.3.2
+colorama==0.4.6
 docutils==0.18.1
 graphviz==0.20.1
 idna==3.6
 imagesize==1.4.1
 Jinja2==3.1.2
+livereload==2.6.3
 MarkupSafe==2.1.3
 packaging==23.2
 Pillow==10.1.0
 Pygments==2.17.2
 requests==2.31.0
 setuptools==69.0.2
+six==1.16.0
 snowballstemmer==2.2.0
 Sphinx==7.2.6
+sphinx-autobuild==2021.3.14
 sphinx-copybutton==0.5.2
 sphinx-rtd-theme==2.0.0
 sphinx-serve==1.0.1
@@ -30,4 +34,5 @@ sphinxcontrib-jsmath==1.0.1
 sphinxcontrib-qthelp==1.0.6
 sphinxcontrib-serializinghtml==1.1.9
 sphinxcontrib-svg2pdfconverter==1.2.2
+tornado==6.4
 urllib3==2.1.0
-- 
GitLab