Overhaul of stylegen
This commit is contained in:
@ -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"
|
||||
|
Reference in New Issue
Block a user