Browse Source

Don't purge web dir if flag is set (#2529)

Nikhil Rao 1 year ago
parent
commit
51a9b75141
1 changed files with 6 additions and 1 deletions
  1. 6 1
      reflex/compiler/compiler.py

+ 6 - 1
reflex/compiler/compiler.py

@@ -460,7 +460,12 @@ def remove_tailwind_from_postcss() -> tuple[str, str]:
 
 
 def purge_web_pages_dir():
-    """Empty out .web directory."""
+    """Empty out .web/pages directory."""
+    if _is_dev_mode() and os.environ.get("REFLEX_PERSIST_WEB_DIR"):
+        # Skip purging the web directory in dev mode if REFLEX_PERSIST_WEB_DIR is set.
+        return
+
+    # Empty out the web pages directory.
     utils.empty_dir(constants.Dirs.WEB_PAGES, keep_files=["_app.js"])