Overhaul of stylegen

This commit is contained in:
2025-03-23 03:23:45 -06:00
parent cff4c4715e
commit 2267706737
7 changed files with 224 additions and 51 deletions

29
lib/stylegen/base.css vendored
View File

@ -1,14 +1,29 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";
@layer base {
html,
container,
body {
height: 100%;
width: 100%;
overflow-y: auto;
position: fixed;
height: 100% !important;
width: 100% !important;
overflow-y: auto !important;
position: fixed !important;
}
main {
margin-left: auto !important;
margin-right: auto !important;
width: 100% !important;
max-width: 100% !important;
text-align: center !important;
}
.container {
margin-left: auto !important;
margin-right: auto !important;
display: flex !important;
flex-direction: column !important;
align-items: center !important;
justify-content: center !important;
}
}

View File

@ -67,7 +67,7 @@ echo "Detected Architecture: $ARCH"
# Function to construct the binary download URL based on version, OS, and architecture
get_binary_url() {
echo "https://github.com/tailwindlabs/tailwindcss/releases/download/$VERSION/tailwindcss-extra-$OS-$ARCH"
echo "https://github.com/tailwindlabs/tailwindcss/releases/download/$VERSION/tailwindcss-$OS-$ARCH"
}
# Create the 'tw' directory for storing the downloaded binary
@ -101,37 +101,12 @@ echo "Extensions: $EXTENSIONS"
echo "Directory: $DIRECTORY"
echo "Output Directory: $OUTPUT_DIR"
# Initialize an array for name conditions
name_conditions=()
# Generate the minified version for production
echo "Generating minified CSS for production..."
"$BINARY" -i "${SCRIPT_DIR}/base.css" -o "${OUTPUT_DIR}/styles.css" --minify
# Assuming $EXTENSIONS is a comma-separated list of extensions
IFS=',' read -ra ADDR <<< "$EXTENSIONS"
for ext in "${ADDR[@]}"; do
name_conditions+=(-name "*.$ext")
done
# Create empty daisyui.css and themes.css files if they don't exist
touch "${OUTPUT_DIR}/daisyui.css"
touch "${OUTPUT_DIR}/themes.css"
# Use find with the array of conditions
INCLUDE_FILES=$(find "$DIRECTORY" -type f \( "${name_conditions[@]}" \))
echo "Files found: $INCLUDE_FILES"
INCLUDE_FILES_ARRAY=$(echo "$INCLUDE_FILES" | awk '{printf "\"%s\",", $0}' | sed 's/,$//')
# Generate Tailwind config in script directory
CONFIG_FILE="${SCRIPT_DIR}/tailwind.config.js"
echo "module.exports = {
content: [$INCLUDE_FILES_ARRAY],
theme: {
extend: {},
},
daisyui: {
themes: [\"night\"],
},
plugins: [require('daisyui'), require('@tailwindcss/typography')],
}" > "$CONFIG_FILE"
# Run the binary with the generated config
"$BINARY" build -i "${SCRIPT_DIR}/base.css" -c "$CONFIG_FILE" -o "${OUTPUT_DIR}/styles.css" --minify
# Wait for all background processes to finish
wait
echo "All CSS files generated"