Skip to content

Support configuring version per profile#123

Merged
SteffenDE merged 28 commits into
phoenixframework:mainfrom
RobinBoers:main
Jun 3, 2026
Merged

Support configuring version per profile#123
SteffenDE merged 28 commits into
phoenixframework:mainfrom
RobinBoers:main

Conversation

@RobinBoers
Copy link
Copy Markdown
Contributor

In our project, we had a place where we were running multiple builds through multiple tailwind profiles, and one had already been updated to be compatible with v4 (and thus incompatible with v3), while the other is still stuck on v3 for now.

I added support to run a different version of the CLI for a profile. If no version is explicitly configured for the profile, it will fall back to the globally configured tailwind version.

This should be a backwards-compatible (aka non-breaking) change.

Comment thread lib/tailwind.ex Outdated
Comment thread lib/tailwind.ex Outdated
Comment thread lib/tailwind.ex Outdated
Comment thread lib/tailwind.ex Outdated
Comment thread lib/mix/tasks/tailwind.install.ex Outdated
Comment thread lib/tailwind.ex Outdated
Comment thread lib/tailwind.ex Outdated
Comment thread lib/tailwind.ex
Comment thread lib/tailwind.ex Outdated
RobinBoers and others added 7 commits April 25, 2025 14:17
Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
The `--if-missing` argument causes this test to be flaky. Previously, when you had downloaded another version, the newer version would automatically be missing and thus always be installed.

Currently, that's no longer the case, because you can have multiple simultanous tailwind installs, so in this case (after the first test run), the newer version already exists.
@RobinBoers
Copy link
Copy Markdown
Contributor Author

RobinBoers commented Aug 13, 2025

Is there anything that needs to be fixed/done from my side to get this merged? Would be nice if we could switch back from our fork to the upstream for our projects.

Comment thread lib/tailwind.ex Outdated
Comment thread lib/tailwind.ex Outdated
Comment thread lib/tailwind.ex Outdated
Comment thread lib/mix/tasks/tailwind.install.ex Outdated
Comment thread lib/tailwind.ex Outdated
Comment thread lib/mix/tasks/tailwind.install.ex Outdated
Comment thread lib/tailwind.ex
Comment thread lib/tailwind.ex
I changed the implementation from raising to non-raising after the suggestion from José, but forgot to also update the docstring.
This now installs the given globally configured `version`, even if no profiles have been configured. This is not super useful because the `mix tailwind <profile>` command won't be usable, but maybe a valid use case when users only want to install the binary and call it themselves.
@RobinBoers RobinBoers requested a review from SteffenDE May 22, 2026 12:45
Comment thread lib/tailwind.ex Outdated
Comment thread lib/tailwind.ex
end

defp target_for_version(version) when is_binary(version) do
Application.get_env(:tailwind, :target, system_target(version))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, if someone overrides the target, it is set for all profiles, which might cause issues if one profile is Tailwind 4 and another one Tailwind 3. So similar to the global path. But if someone runs into this a separate PR to move path and target into a per-profile config would be welcome, so it can be overridden if necessary, falling back to the global or default.

Comment thread test/tailwind_test.exs Outdated
@SteffenDE SteffenDE merged commit ed088d9 into phoenixframework:main Jun 3, 2026
2 checks passed
@SteffenDE
Copy link
Copy Markdown
Member

🙌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants