tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Are there plans to update this for TailwindCSS v4?

Open bobrocke opened this issue 9 months ago • 1 comments

That would be very helpful.

bobrocke avatar May 08 '25 23:05 bobrocke

Hi Bob. See #10. If you would be willing to help extend that PR to support v4, that would be greatly appreciated.

justinmayer avatar May 09 '25 05:05 justinmayer

In our project, we manually inject tailwind v4 support with the following script:

# Find the plugin installation directory
PLUGIN_DIR=$(python3 -c "
import os
import pelican.plugins.tailwindcss
plugin_path = os.path.dirname(pelican.plugins.tailwindcss.__file__)
print(plugin_path)
" 2>/dev/null)

if [ -z "$PLUGIN_DIR" ]; then
    echo "Could not find pelican-tailwindcss plugin installation directory"
    exit 1
fi

PACKAGE_JSON="$PLUGIN_DIR/package.json"
if [ ! -f "$PACKAGE_JSON" ]; then
    echo "package.json not found at $PACKAGE_JSON"
    exit 1
fi

# Backup original package.json
cp "$PACKAGE_JSON" "$PACKAGE_JSON.backup"
echo "Backed up original package.json"

# Check current package.json content
if grep -q "@tailwindcss/cli" "$PACKAGE_JSON" && grep -q "@tailwindcss/postcss" "$PACKAGE_JSON"; then
    echo "Tailwind v4 dependencies already present in package.json"
else
    echo "Tailwind v4 dependencies missing, updating package.json..."

    # Create updated package.json with v4 dependencies
    cat > "$PACKAGE_JSON" << 'EOF'
{
    "name": "tailwindcss",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "tailwindcss": "tailwindcss"
    },
    "author": "",
    "license": "AGPL-3.0",
    "dependencies": {
        "@tailwindcss/cli": "^4.1.12",
        "@tailwindcss/postcss": "^4.1.12",
        "tailwindcss": "^4.1.12"
    }
}
EOF
    echo "Updated package.json with Tailwind v4 dependencies"
fi

# Remove outdated lock file if it exists
if [ -f "$PLUGIN_DIR/package-lock.json" ]; then
    echo "Removing outdated package-lock.json..."
    rm "$PLUGIN_DIR/package-lock.json"
fi

knz avatar Aug 29 '25 08:08 knz

Hi Bob. See https://github.com/pelican-plugins/tailwindcss/pull/10. If you would be willing to help extend that PR to support v4, that would be greatly appreciated.

Are you sure your PR #10 does not support tailwind v4 already?

knz avatar Aug 29 '25 08:08 knz

FYI I've published a docker image containing pelican, the tailwind plugin with v4 support:

  • https://github.com/knz/pelican-docker-build
  • https://hub.docker.com/r/kena42/pelican-docker-build

knz avatar Aug 29 '25 10:08 knz

I do not believe that the aforementioned pull request, nor pelican-tailwindcss 0.4.0 that contains those changes, currently supports Tailwind CSS v4. Pull requests to add support for Tailwind CSS v4, along with corresponding additions to the test suite, would be welcomed and greatly appreciated.

justinmayer avatar Oct 27 '25 12:10 justinmayer