diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-11 23:52:49 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-11 23:52:49 -0500 |
| commit | b0ca38bc98f240e208edd08009856ab6de62c227 (patch) | |
| tree | 0412890e4480ade5e954104d428178bba3f4e64c /docs/prototypes/gen_tokens.py | |
| parent | b137223e76c75217b594bc5e46e7625b10e31b0f (diff) | |
| download | archsetup-b0ca38bc98f240e208edd08009856ab6de62c227.tar.gz archsetup-b0ca38bc98f240e208edd08009856ab6de62c227.zip | |
refactor(gallery): rename generated tokens.el to gallery-tokens.el
The generated file declares (provide 'gallery-tokens), but `require` resolves a feature by filename, so as tokens.el it could never load from a load-path. The name now matches the feature. gen_tokens.py, the renderer's load, and the README follow.
Diffstat (limited to 'docs/prototypes/gen_tokens.py')
| -rw-r--r-- | docs/prototypes/gen_tokens.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/prototypes/gen_tokens.py b/docs/prototypes/gen_tokens.py index f966451..9f011e9 100644 --- a/docs/prototypes/gen_tokens.py +++ b/docs/prototypes/gen_tokens.py @@ -29,7 +29,7 @@ Usage: The web CSS is written into panel-widget-gallery.html between the `/* @tokens:start */` and `/* @tokens:end */` markers; the waybar and elisp -targets are written to tokens-waybar.css and tokens.el beside it. +targets are written to tokens-waybar.css and gallery-tokens.el beside it. """ import json @@ -39,6 +39,10 @@ HERE = os.path.dirname(os.path.abspath(__file__)) TOKENS_START = "/* @tokens:start */" TOKENS_END = "/* @tokens:end */" +# The elisp target's filename must match its (provide 'gallery-tokens) so +# `require` resolves it from a load-path. +DEFAULT_ELISP_NAME = "gallery-tokens.el" + # sections whose values are plain colors (searched by resolve_color, and the # ones that become @define-color / alist color entries) COLOR_SECTIONS = ("palette", "amber") @@ -152,7 +156,7 @@ def main(tokens_path=None, html_path=None, waybar_path=None, elisp_path=None): tokens_path = tokens_path or os.path.join(HERE, "tokens.json") html_path = html_path or os.path.join(HERE, "panel-widget-gallery.html") waybar_path = waybar_path or os.path.join(HERE, "tokens-waybar.css") - elisp_path = elisp_path or os.path.join(HERE, "tokens.el") + elisp_path = elisp_path or os.path.join(HERE, DEFAULT_ELISP_NAME) with open(tokens_path) as f: tokens = json.load(f) |
