Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Linux MUSL v3 and v4 #115

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# CHANGELOG

## v0.3.1

* Support correct target for Linux MUSL with Tailwind v3.

## v0.3.0 (2025-02-26)

Support Tailwind v4+. This release drops official support for Tailwind v3.
If you want to continue using Tailwind v3, please pin the `tailwind` dependency to a 0.2 version:
* Support Tailwind v4+. This release assumes Tailwind v4 for new projects.

```elixir
{:tailwind, "~> 0.2.0", only: :dev}`
```
Note: v0.3.0 dropped target code for handling Linux MUSL with Tailwind v3. Use v0.3.1+ instead.

## v0.2.4 (2024-10-18)

Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,8 @@ Tailwind version of choice:
config :tailwind, version: "4.0.9"
```

Note that `:tailwind` 0.3+ supports Tailwind v4+. If you need to use Tailwind v3, use

```
{:tailwind, "~> 0.2.0", only: :dev}
```

instead, and refer to [the README in the 0.2 branch](https://github.com/phoenixframework/tailwind/blob/v0.2/README.md).
Note that `:tailwind` 0.3+ assumes Tailwind v4+ by default. It still supports Tailwind v3, but some configuration options when setting up a new
project might be different. If you use Tailwind v3, also have a look at [the README in the 0.2 branch](https://github.com/phoenixframework/tailwind/blob/v0.2/README.md).

Now you can install Tailwind by running:

Expand Down
31 changes: 22 additions & 9 deletions lib/tailwind.ex
Original file line number Diff line number Diff line change
Expand Up @@ -282,23 +282,36 @@ defmodule Tailwind do
{{:unix, :freebsd}, arch, _abi, 64} when arch in ~w(x86_64 amd64) ->
"freebsd-x64"

{{:unix, :linux}, "aarch64", "musl", 64} ->
"linux-arm64-musl"
{{:unix, :linux}, "aarch64", abi, 64} ->
"linux-arm64" <> maybe_add_abi_suffix(abi)

{{:unix, :linux}, "aarch64", _abi, 64} ->
"linux-arm64"
{{:unix, :linux}, "arm", _abi, 32} ->
"linux-armv7"

{{:unix, _osname}, arch, "musl", 64} when arch in ~w(x86_64 amd64) ->
"linux-x64-musl"
{{:unix, :linux}, "armv7" <> _, _abi, 32} ->
"linux-armv7"

{{:unix, _osname}, arch, _abi, 64} when arch in ~w(x86_64 amd64) ->
"linux-x64"
{{:unix, _osname}, arch, abi, 64} when arch in ~w(x86_64 amd64) ->
"linux-x64" <> maybe_add_abi_suffix(abi)

{_os, _arch, _abi, _wordsize} ->
raise "tailwind is not available for architecture: #{arch_str}"
end
end

defp maybe_add_abi_suffix("musl") do
# Tailwind CLI v4+ added explicit musl versions for Linux as
# tailwind-linux-x64-musl
# tailwind-linux-arm64-musl
if Version.match?(configured_version(), "~> 4.0") do
"-musl"
else
""
end
end

defp maybe_add_abi_suffix(_), do: ""

defp fetch_body!(url, retry \\ true) when is_binary(url) do
scheme = URI.parse(url).scheme
url = String.to_charlist(url)
Expand Down Expand Up @@ -339,7 +352,7 @@ defmodule Tailwind do
The tailwind binary couldn't be found at: #{url}
This could mean that you're trying to install a version that does not support the detected
target architecture.
target architecture. For example, Tailwind v4+ dropped support for 32-bit ARM.
You can see the available files for the configured version at:
Expand Down