This commit is contained in:
Atridad Lahiji
2023-05-18 20:04:55 -06:00
committed by Atridad Lahiji
parent 84591f3a2d
commit 3d719132f1
96 changed files with 3422 additions and 4793 deletions
+14
View File
@@ -0,0 +1,14 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
html,
container,
body {
height: 100%;
width: 100%;
overflow-y: auto;
position: fixed;
}
}
+85
View File
@@ -0,0 +1,85 @@
#!/bin/sh
OS=$(uname -s)
ARCH=$(uname -m)
# Normalize OS and ARCH identifiers
case $OS in
"Darwin")
OS="macos"
;;
"Linux")
OS="linux"
;;
"CYGWIN"*|"MINGW"*|"MSYS"*)
OS="windows"
;;
*)
echo "Unknown operating system: $OS"
exit 1
;;
esac
# For macOS, we use a single binary called 'macos'
if [ "$OS" = "macos" ]; then
BINARY="./tw/macos"
else
case $ARCH in
"x86_64")
ARCH="x64"
;;
"arm64")
ARCH="arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
# Construct the binary file name
BINARY="./tw/${OS}-${ARCH}"
if [ "$OS" = "windows" ]; then
BINARY="${BINARY}.exe"
else
# Set execute permissions on the binary
chmod +x $BINARY
fi
fi
echo $BINARY
# Infer pages from .html files in the pages directory
PAGES=$(ls ../pages/templates/*.html | xargs -n 1 basename | cut -d. -f1)
# Run the binary for each page
for PAGE in $PAGES; do
(
# Detect which partials are being used in this page
PARTIALS=$(grep -o -E '{{template "[^"]+' ../pages/templates/${PAGE}.html | cut -d'"' -f2 | xargs -I{} echo \"../pages/templates/partials/{}.html\")
# Generate an array of partials and join them with commas
PARTIALS_ARRAY=$(echo $PARTIALS | tr ' ' ',')
# Always include the "header" partial and any other partials that are always used
PARTIALS_ARRAY=\"../pages/templates/partials/header.html\",\"../pages/templates/partials/global.html\",$PARTIALS_ARRAY
# Generate Tailwind config for this page
echo "module.exports = {
content: [\"../pages/templates/${PAGE}.html\", \"../pages/templates/layouts/*.html\", $PARTIALS_ARRAY],
theme: {
extend: {},
},
daisyui: {
themes: [\"night\"],
},
plugins: [require('daisyui'), require('@tailwindcss/typography')],
}" > tailwind.config.${PAGE}.js
# Run the binary with the generated config
$BINARY build -i ./base.css -c tailwind.config.${PAGE}.js -o ../public/css/styles.${PAGE}.css --minify
) &
done
# Wait for all background processes to finish
wait
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.