Skip to content

Commit 0469882

Browse files
authored
Add live reloading (esphome#1786)
Replace the existing webserver target with a live-reloading target. Adds a dependency on https://github.com/executablebooks/sphinx-autobuild
1 parent 497258c commit 0469882

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ RUN pip3 install --no-cache-dir --no-binary :all: -r requirements.txt
1515
EXPOSE 8000
1616
WORKDIR /data/esphomedocs
1717

18-
CMD ["make", "webserver"]
18+
CMD ["make", "live-html"]

Makefile

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
ESPHOME_PATH = ../esphome
22
ESPHOME_REF = 2022.1.2
33

4-
.PHONY: html html-strict cleanhtml deploy help webserver Makefile netlify netlify-api api netlify-dependencies svg2png copy-svg2png minify
4+
.PHONY: html html-strict cleanhtml deploy help live-html Makefile netlify netlify-api api netlify-dependencies svg2png copy-svg2png minify
55

66
html:
77
sphinx-build -M html . _build -j auto -n $(O)
8+
live-html:
9+
sphinx-autobuild . _build -j auto -n $(O) --host 0.0.0.0
810

911
html-strict:
1012
sphinx-build -M html . _build -W -j auto -n $(O)
@@ -48,9 +50,6 @@ copy-svg2png:
4850

4951
netlify: netlify-dependencies netlify-api html copy-svg2png
5052

51-
webserver: html
52-
cd "_build/html" && python3 -m http.server
53-
5453
lint: html-strict
5554
python3 travis.py
5655

guides/contributing.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,12 @@ To check your documentation changes locally, you first need install Sphinx (with
110110
# in ESPHome-Docs repo:
111111
pip install -r requirements.txt
112112
113-
Then, use the provided Makefile to build the changes and start a simple web server:
113+
Then, use the provided Makefile to build the changes and start a live-updating web server:
114114

115115
.. code-block:: bash
116116
117117
# Start web server on port 8000
118-
make webserver
119-
120-
# Updates then happen via:
121-
make html
118+
make live-html
122119
123120
Notes
124121
*****

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
sphinx==4.3.2
2+
sphinx-autobuild==2021.3.14

0 commit comments

Comments
 (0)