<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="296182" data-post-id="296182">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="arcanemachine" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/arcanemachine/120/29109_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  arcanemachine
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>You are overcomplicating things. I just tested this with a fresh Phoenix 1.7.7 project:</p>
<h2><a name="p-296182-setup-daisyui-1" class="anchor" href="#p-296182-setup-daisyui-1" aria-label="Heading link" rel="nofollow"></a>Setup DaisyUI</h2>
<ul>
<li>
<p>Create project:</p>
<ul>
<li><code>mix phx.new your_project</code></li>
</ul>
</li>
<li>
<p>Initialize an npm project in the directory <code>assets/</code>:</p>
<ul>
<li><code>cd assets &amp;&amp; npm init -y</code></li>
</ul>
</li>
<li>
<p>Add npm dependency <code>daisyui</code> in the directory <code>assets/</code>:</p>
<ul>
<li><code>cd assets &amp;&amp; npm i -D daisyui@latest</code></li>
</ul>
</li>
<li>
<p>Add daisyUI to Tailwind plugins list (in <code>assets/tailwind.config.js</code>):</p>
<ul>
<li><code>require("daisyUI")</code></li>
</ul>
</li>
</ul>
<pre data-code-wrap="diff"><code class="lang-diff">  plugins: [
+    require('daisyui'),
    require("@tailwindcss/forms"),
</code></pre>
<hr>
<ul>
<li>DaisyUI is now installed! Let’s try an example component:</li>
</ul>
<p><code>lib/your_project_web/controllers/page_html/home.html.heex</code></p>
<pre data-code-wrap="diff"><code class="lang-diff">    &lt;h1 class="text-brand mt-10 flex items-center text-sm font-semibold leading-6"&gt;
      Phoenix Framework
      &lt;small class="bg-brand/5 text-[0.8125rem] ml-3 rounded-full px-2 font-medium leading-6"&gt;
        v&lt;%= Application.spec(:phoenix, :vsn) %&gt;
      &lt;/small&gt;
    &lt;/h1&gt;

+    &lt;div class="btn btn-primary"&gt;
+      Hello daisyUI!
+    &lt;/div&gt;

    &lt;p class="text-[2rem] mt-4 font-semibold leading-10 tracking-tighter text-zinc-900"&gt;
      Peace of mind from prototype to production.
    &lt;/p&gt;
</code></pre>
<p>It worked (for me, at least <img src="https://forum.elixirforum.com/images/emoji/apple/grin.png?v=15" title=":grin:" class="emoji" alt=":grin:" loading="lazy" width="20" height="20">)!</p>
<p>At this point, daisyUI is installed and everything should be working as expected.</p>
<hr>
<p>Now for the deployment:</p>
<h2><a name="p-296182-deploy-to-flyio-2" class="anchor" href="#p-296182-deploy-to-flyio-2" aria-label="Heading link" rel="nofollow"></a>Deploy to <a href="http://Fly.io" rel="noopener nofollow ugc">Fly.io</a></h2>
<ul>
<li>
<p>Create <a href="http://Fly.io" rel="noopener nofollow ugc">Fly.io</a> app:</p>
<ul>
<li>‘flyctl launch’</li>
</ul>
</li>
<li>
<p>Fix issues with the default Dockerfile generated when we ran <code>fly launch</code>:</p>
<ul>
<li>Use <code>apt-get</code> to install <code>nodejs</code> and <code>npm</code></li>
<li>Install our project’s <code>npm</code> dependencies</li>
</ul>
</li>
</ul>
<pre data-code-wrap="diff"><code class="lang-diff">FROM ${BUILDER_IMAGE} as builder

# install build dependencies
-RUN apt-get update -y &amp;&amp; apt-get install -y build-essential git \
+RUN apt-get update -y &amp;&amp; apt-get install -y build-essential git nodejs npm \
     &amp;&amp; apt-get clean &amp;&amp; rm -f /var/lib/apt/lists/*_*
 
# ...

COPY priv priv

COPY lib lib

COPY assets assets
 
+# install npm dependencies
+RUN cd assets &amp;&amp; npm install
+
# compile assets
RUN mix assets.deploy

</code></pre>
<h2><a name="p-296182-bonus-prevent-daisyui-from-spamming-the-console-when-tailwindconfigjs-is-modified-3" class="anchor" href="#p-296182-bonus-prevent-daisyui-from-spamming-the-console-when-tailwindconfigjs-is-modified-3" aria-label="Heading link" rel="nofollow"></a>Bonus: Prevent daisyUI from spamming the console when <code>tailwind.config.js</code> is modified</h2>
<p>By default, daisyUI will print a message like this to the console whenever <code>tailwind.config.js</code> is modified:</p>
<pre><code class="lang-plaintext">🌼 daisyUI 3.5.0 https://daisyui.com
╰╮
 ╰─ ✔︎ [ 2 ] themes are enabled. You can add more themes or make your own theme:
      https://daisyui.com/docs/themes

    ❤︎ Support daisyUI: https://opencollective.com/daisyui
</code></pre>
<p>That’s annoying. Let’s disable that:</p>
<p><code>assets/tailwind.config.js</code></p>
<pre data-code-wrap="diff"><code class="lang-diff">module.exports = {
  content: ["./js/**/*.js", "../lib/*_web.ex", "../lib/*_web/**/*.*ex"],
+  daisyui: {
+    logs: false,
+  },
  plugins:  [
</code></pre>
<hr>
<h2><a name="p-296182-bonus-remove-tailwindforms-to-avoid-conflicts-with-daisyui-form-components-4" class="anchor" href="#p-296182-bonus-remove-tailwindforms-to-avoid-conflicts-with-daisyui-form-components-4" aria-label="Heading link" rel="nofollow"></a>Bonus: Remove <code>tailwind/forms</code> to avoid conflicts with daisyUI form components</h2>
<p>The Tailwind forms package will cause conflicts with daisyUI forms. Let’s get rid of it:</p>
<p><code>assets/tailwind.config.js</code></p>
<pre data-code-wrap="diff"><code class="lang-diff">  plugins: [
    require("daisyui"),
-    require("@tailwindcss/forms"),
    require("@tailwindcss/typography"),
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="296182" data-batch-url="/posts/batch_likers">
                        10
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-get-daisyui-and-phoenix-to-work/46612/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-296182" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="296182"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #31"></div>
  </section>
</div>
    <div class="postbit" id="296184" data-post-id="296184">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="PJUllrich" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/PJUllrich/120/15944_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  PJUllrich
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Building Table Views with Phoenix LiveView</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for the suggestion. That’s what I had at first but I always got the error “Cannot find “taildwindcss/plugin”. When I removed the DaisyUI plugin from my tailwind.config.js, everything worked fine. But when I added it, it broke. That’s why I went down the npm route.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="296184" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-get-daisyui-and-phoenix-to-work/46612/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-296184" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="296184"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #32"></div>
  </section>
</div>
    <div class="postbit" id="296185" data-post-id="296185">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="arcanemachine" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/arcanemachine/120/29109_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  arcanemachine
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Interesting. Maybe some configuration changed during an upgrade or something?</p>
<p>This is why I like to compare against a fresh project. It helps me to isolate the potential cause of any such strangeness.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="296185" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-get-daisyui-and-phoenix-to-work/46612/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-296185" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="296185"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #33"></div>
  </section>
</div>
    <div class="postbit" id="296246" data-post-id="296246">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="belgoros" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/belgoros/120/39798_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  belgoros
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="arcanemachine" data-post="32" data-topic="46612">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/arcanemachine/48/29109_2.png" class="avatar"> arcanemachine:</div>
<blockquote>
<p><code>ogs: false,</code></p>
</blockquote>
</aside>
<p>Worked like a charm, yay, thanks a lot!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="296246" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-get-daisyui-and-phoenix-to-work/46612/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-296246" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="296246"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #34"></div>
  </section>
</div>
    <div class="postbit" id="296281" data-post-id="296281">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cvkmohan" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cvkmohan/120/39944_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cvkmohan
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/pjullrich" rel="nofollow">@PJUllrich</a> - I guess <code>npm install daisyui</code> is the missing step - either in development or in production - wherever the error happens.</p><aside class="quote" data-post="18" data-topic="46612">
  <div class="title">
    <div class="quote-controls"></div>
    <img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cvkmohan/48/39944_2.png" class="avatar">
    <div class="quote-title__text-content">
      <a href="https://forum.elixirforum.com/t/how-to-get-daisyui-and-phoenix-to-work/46612/18" rel="nofollow">How to get DaisyUI and Phoenix to work?</a> <a class="badge-category__wrapper " href="/c/questions-help/questions/53" rel="nofollow"><span data-category-id="53" style="--category-badge-color: #C14BFB; --category-badge-text-color: #000000; --parent-category-badge-color: #C14BFB;" data-parent-category-id="171" data-drop-close="true" class="badge-category --style-square --has-parent" title="Elixir Questions / Help"><span class="badge-category__name">Questions</span></span></a>
    </div>
  </div>
  <blockquote>
    I just realized that tailwindcss-cli is working with 3rd party plugins also in the latest version. That would mean that the best way to integrate daisyui into phoenix application is: 

create a new phoenix application.
Use <a href="https://github.com/phoenixframework/tailwind" rel="noopener nofollow ugc">phoenixframework/tailwind: An installer for tailwind (github.com)</a> to integrate tailwindcss into the project
cd assets
yarn add daisyui
In your tailwind.config.js file add the line  plugins: [require("daisyui")],


That is it. There is no 6th step. <img width="20" height="20" src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title="slight_smile" alt="slight_smile" class="emoji">
  </blockquote>
</aside>

<p>The above steps are still working for me. For fly deployment the above <a class="mention" href="/u/arcanemachine" rel="nofollow">@arcanemachine</a> steps are sufficient.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="296281" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-get-daisyui-and-phoenix-to-work/46612/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-296281" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="296281"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>