Pi66

merodi
A markdown-based static site generator.
git clone https://git.pi66.xyz/merodi

← back to log

feat: add dev_tools config option to webview

author: pi66
date: 2026-06-27 22:08
hash: 90e6b501155367864e4149202d1d76a255638931

Diffstat:

M

src/config.py
3 ++++++++++++++++++++++++++++++

M

src/modules.py
1 ++++++++++

M

src/webviewer.py
2 ++++++++++----------
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff --git a/src/config.py b/src/config.py
index ec325a1..366c215 100644
--- a/src/config.py
+++ b/src/config.py
@@ -24,6 +24,7 @@ def init_config_struct(project_name:str) -> Config:
         webview = Webview(
             host = "localhost",
             port = 8866,
+            dev_tools = "true",
             html_path   = "/",
             static_path = "/static"
         ),
@@ -49,6 +50,7 @@ plugins   = "{config.tree.plugins}"
 [webview]
 host  = "{config.webview.host}"
 port  = {config.webview.port}
+dev_tools = {config.webview.dev_tools}
 html_path   = "{config.webview.html_path}"
 static_path = "{config.webview.static_path}"

@@ -101,6 +103,7 @@ def load_webview_config(project_path:str) -> Webview:
     return Webview(
         host        = config["webview"]["host"],
         port        = config["webview"]["port"],
+        dev_tools    = config["webview"]["dev_tools"],
         html_path   = config["webview"]["html_path"],
         static_path = config["webview"]["static_path"],
     )
diff --git a/src/modules.py b/src/modules.py
index 1727055..2e1ecb2 100644
--- a/src/modules.py
+++ b/src/modules.py
@@ -18,6 +18,7 @@ class Tree:
 class Webview:
     host        : str
     port        : int
+    dev_tools   : str
     html_path   : str
     static_path : str

diff --git a/src/webviewer.py b/src/webviewer.py
index 6337da7..6f53a63 100644
--- a/src/webviewer.py
+++ b/src/webviewer.py
@@ -126,7 +126,7 @@ def run(project_path):

         window = webview.create_window("Merodi", url=f"http://{host}:{port}/")
         watch_files(window, tree_config, webview_config, extras_config)
-        webview.start()
+        webview.start(debug=webview_config.dev_tools in ["true",1])


     except KeyboardInterrupt: