Last active
December 18, 2021 23:31
-
-
Save aroemers/c08d51c411718176048e2af572269c2f to your computer and use it in GitHub Desktop.
Tailwind CLI wrapper script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/.tailwind |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
TAILWIND_VERSION="${TAILWIND_VERSION:-v3.0.7}" | |
# Determine correct binary | |
ARCHTYPE=$(uname -m) | |
case "$ARCHTYPE" in | |
x86_64) ARCH="x64" ;; | |
arm) ARCH="arm64" ;; | |
*) echo "Unknown/unsupported architucture: $ARCHTYPE"; exit 1 ;; | |
esac | |
case "$OSTYPE" in | |
darwin*) TAILWIND_CLI="tailwindcss-macos-$ARCH" ;; | |
linux*) TAILWIND_CLI="tailwindcss-linux-$ARCH" ;; | |
*) echo "Unknown/unsupported OS: $OSTYPE"; exit 1 ;; | |
esac | |
# Path to this script's directory | |
SCRIPTDIR=$(dirname "$0") | |
# Expected location of cli binary | |
CLIDIR="$SCRIPTDIR/.tailwind/wrapper/$TAILWIND_VERSION" | |
CLI="$CLIDIR/$TAILWIND_CLI" | |
# Download if binary not exists | |
if [ ! -f "$CLI" ]; then | |
TAILWIND_DOWNLOAD="https://github.com/tailwindlabs/tailwindcss/releases/download/$TAILWIND_VERSION/$TAILWIND_CLI" | |
echo "Downloading $TAILWIND_DOWNLOAD to $CLIDIR ..." | |
curl -L -o "$CLI" --create-dirs "$TAILWIND_DOWNLOAD" | |
chmod +x "$CLI" | |
fi | |
echo "Tailwind wrapper executing: $CLI $@" | |
"$CLI" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment