How to get DaisyUI and Phoenix to work?

Finding the article you referred to gave me the missing piece.

Here are the relevant steps. I assume you have a Phoenix app setup and npm installed on you device.

  1. Install and setup the Elixir Tailwind library. The README of the library is a great resource.
  2. Publish your app to fly using flyctl. This post is a great guide. Just note that the fly commands in the post might need to be replaced with flyctl commands.
  3. On your local machine, cd into your project’s assets folder and run npm init.
  4. From within your assets folder, follow the DaisyUI installation steps.
  5. Update the Dockerfile generated during the early fly.io deployment. Perform the following
    a. Ensure the COPY lib lib command comes before the RUN mix assets.deploy commnd
    b. Include this command RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error in the Dockerfile. This should also come before the RUN mix assets.deploy command

Expectedly, you should be good to go and your app should properly deploy to fly.io :clinking_glasses:

16 Likes