Skip to content

feat(tailwindcss): Add Tailwind detection for Elixir Phoenix projects #3831

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

Merged
merged 1 commit into from
May 10, 2025

Conversation

dbernheisel
Copy link
Contributor

This PR enhances root directory detection for the latest versions of TailwindCSS (v4), which no longer require tailwind.config.* or postcss.config.*, for Elixir/Phoenix projects. Phoenix projects generate with Tailwind installed via https://github.com/phoenixframework/tailwind.

@dbernheisel dbernheisel requested a review from glepnir as a code owner May 9, 2025 13:31
@dbernheisel dbernheisel force-pushed the db-add-tailwind-mix-lock branch 2 times, most recently from 0eb260b to 3ecb4a5 Compare May 9, 2025 17:06
This PR enhances root directory detection for the latest versions of
TailwindCSS v4, which no longer require tailwind.config.* or
postcss.config.*.

For Phoenix projects, they are typically generated or add Tailwind
installed via https://github.com/phoenixframework/tailwind which will
now be detected by scanning the mix.lock file for the included package.

Phoenix projects that install tailwindcss via package.json should still
work.
@dbernheisel dbernheisel force-pushed the db-add-tailwind-mix-lock branch from 3ecb4a5 to d46fd12 Compare May 9, 2025 17:36
---
--- NOTE: this does a "breadth-first" search, so is broken for multi-project workspaces:
--- https://github.com/neovim/nvim-lspconfig/issues/3818#issuecomment-2848836794
function M.insert_mix_exs(config_files, field, fname)
Copy link
Member

Choose a reason for hiding this comment

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

We're trying to eliminate util.lua, not grow it.

As a compromise, I will merge this and followup with a PR that generalizes insert_package_json, it has no reason to hardcode 'package.json', 'package.json5' ...

@justinmk justinmk merged commit af4a9f5 into neovim:master May 10, 2025
10 checks passed
@justinmk
Copy link
Member

Could you please confirm that #3833 works for you?

@dbernheisel
Copy link
Contributor Author

@justinmk yessir! works great. Thanks for making it more extensible!

@dbernheisel
Copy link
Contributor Author

@justinmk I just realized that lspconfig has two configs for lsps now:

  1. one for nvim-0.11+ https://github.com/neovim/nvim-lspconfig/blob/master/lsp/tailwindcss.lua
  2. older style in https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/tailwindcss.lua

I suppose the older style is best-effort, but is there any reason not to update the older style?

@justinmk
Copy link
Member

I suppose the older style is best-effort, but is there any reason not to update the older style?

old configs are frozen and will be deleted

@dbernheisel dbernheisel deleted the db-add-tailwind-mix-lock branch May 10, 2025 16:20
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.

2 participants