Thought cabinet

This commit is contained in:
2024-12-11 19:21:57 -07:00
parent 50acba5cdb
commit bb6662d7b1
41 changed files with 32477 additions and 2338 deletions

28
task/inject-importmap Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
importmap="$1"
tmp="$(mktemp)"
awk '
BEGIN {
s="<!-- start importmap -->"
e="<!-- end importmap -->"
}
FILENAME != "index.html" {
d=d $0 "\n"
next
}
$0 == s || $0 == e { print }
$0 == s,$0 == e {
if(d) {
print "<script type=\"importmap\">"
printf d;
d = ""
print "</script>"
}
next
}
{ print }
' "$importmap" index.html > "$tmp" \
&& mv "$tmp" index.html