Skip to content

Commit 7aa4226

Browse files
committed
fix: serve or build mkdocs
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 065e1d2 commit 7aa4226

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

{{cookiecutter.project_name}}/noxfile.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
from __future__ import annotations
22

3-
{%- if cookiecutter.docs == 'sphinx' %}
4-
3+
{% if cookiecutter.docs == 'sphinx' -%}
54
import argparse
6-
7-
{%- endif %}
8-
5+
{% endif -%}
96
import shutil
107
from pathlib import Path
118

@@ -109,12 +106,16 @@ def build_api_docs(session: nox.Session) -> None:
109106
@nox.session(reuse_venv=True, default=False)
110107
def docs(session: nox.Session) -> None:
111108
"""
112-
Serve the docs
109+
Make or serve the docs. Pass --non-interactive to avoid serving.
113110
"""
114111

115112
doc_deps = nox.project.dependency_groups(PROJECT, "docs")
116113
session.install("{% if cookiecutter.backend != "mesonpy" %}-e{% endif %}.", *doc_deps)
117-
session.run("mkdocs", "serve", "--clean")
114+
115+
if session.interactive:
116+
session.run("mkdocs", "serve", "--clean", *session.posargs)
117+
else:
118+
session.run("mkdocs", "build", "--clean", *session.posargs)
118119

119120

120121
{%- endif %}

0 commit comments

Comments
 (0)