live_svelte icon indicating copy to clipboard operation
live_svelte copied to clipboard

tailwind config

Open CatalinPlesu opened this issue 2 months ago • 2 comments

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.

  1. Copy the example configuration file example_project/assets/tailwind.config.js into your project's assets/ directory.

  2. Update the build arguments in your main configuration file config/config.exs for the :tailwind package to explicitly include the config file:

    # In config/config.exs
    
    config :tailwind,
      args: [
        "--config=tailwind.config.js",
        # ... 
      ]
    

CatalinPlesu avatar Oct 07 '25 10:10 CatalinPlesu

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

woutdp avatar Oct 07 '25 18:10 woutdp

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";

guess avatar Oct 16 '25 19:10 guess