asw-v01: modern CSS reset, fix README token docs, add watch.py live rebuild

- Rewrite 00-reset.css with :where()-wrapped zero-specificity rules
- Fix README token docs (--asw-* was incorrect, actual tokens use bare --*)
- Add watch.py (pyinotify-based auto-rebuild of dist/asw.css on src/ changes)
This commit is contained in:
Vigilio Desto 2026-06-07 11:42:00 +02:00
parent 9651dd5515
commit 9fd9096f0a
Signed by: Vigo
GPG key ID: 159D6AD58C8E55E9
5 changed files with 290 additions and 82 deletions

32
watch.py Normal file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env python3
"""Watch src/ for changes and rebuild dist/asw.css."""
import os
import subprocess
import pyinotify
WATCH_DIR = os.path.expanduser("~/projects/asw/src")
BUILD_CMD = ["npm", "run", "build"]
class RebuildHandler(pyinotify.ProcessEvent):
def process_default(self, event):
if event.name and event.name.endswith(".css"):
print(f"[watch] {event.name} changed → rebuilding...")
result = subprocess.run(BUILD_CMD, cwd=os.path.dirname(WATCH_DIR),
capture_output=True, text=True)
if result.returncode == 0:
print("[watch] Build OK")
else:
print(f"[watch] Build FAILED:\n{result.stderr}")
def main():
wm = pyinotify.WatchManager()
mask = pyinotify.IN_MODIFY | pyinotify.IN_CREATE | pyinotify.IN_DELETE
handler = RebuildHandler()
notifier = pyinotify.Notifier(wm, handler)
wm.add_watch(WATCH_DIR, mask, rec=True)
print(f"[watch] Watching {WATCH_DIR} for changes. Ctrl+C to stop.")
notifier.loop()
if __name__ == "__main__":
main()