about summary refs log tree commit diff
path: root/users/sterni/nix/fun
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-08-25T00·45+0200
committersterni <sternenseemann@systemli.org>2021-08-26T15·34+0000
commit9ed439bfbddee7915c4011f8a6ba7562b3375ac8 (patch)
tree6343c44bb40676d684aceec57bab7b26388f7914 /users/sterni/nix/fun
parent17d78867bbef8a3df1271137a2db18b3584cdc39 (diff)
feat(users/sterni/nix): cursed nix html DSL r/2784
Couldn't sleep, so I made a surprisingly neat way to render HTML
documents in Nix using our favorite feature __findFile:

  let
    inherit (depot.users.sterni.nix.html) __findFile esc;

  in

  <html> {} [
    (<head> {} [
      (<meta> { charset = "utf-8"; } null)
      (<title> {} (esc "hello"))
    ])
    (<body> {} [
      (<h1> {} (esc "hello world"))
    ])
  ]

=> "<html><head><meta charset=\"utf-8\"/><title>hello</title></head><body><h1>hello world</h1></body></html>"

Change-Id: Id36808a56ae3da3b5263c06f29342fc22d105c21
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3410
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'users/sterni/nix/fun')
0 files changed, 0 insertions, 0 deletions