tailwind config
Environment
- Erlang:
27.3.4.2 - Elixir:
1.18.4 - Phoenix:
{:phoenix, "~> 1.8.1"}
Problem
The Tailwind CSS and DaisyUI styles are not applied in the new project.
I tought that simply copying the tailwind.config.js from example_project/assets/tailwind.config.js into my assets folder would solve the probelm but it appears that tailwind isn't configured to use a config in a new project.
Fix: Configure Tailwind
The solution requires two steps: copying the configuration and updating the Phoenix build arguments.
-
Copy the example configuration file example_project/assets/tailwind.config.js into your project's
assets/directory. -
Update the build arguments in your main configuration file
config/config.exsfor the:tailwindpackage to explicitly include the config file:# In config/config.exs config :tailwind, args: [ "--config=tailwind.config.js", # ... ]
Thank you for this! I guess this is because of the latest tailwind version not requiring a tailwind.config.js file anymore. Will take a look at this when I have some time. Also feel free to create a PR if you have a fix in mind
I just created a new phoenix project to test and I believe all you have to do is add this to app.css and you can ditch the tailwind.config.js entirely:
@source "../svelte";