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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tadasajon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/120/23216_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tadasajon
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="tadasajon" data-post="10" data-topic="43791">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/48/23216_2.png" class="avatar"> tadasajon:</div>
<blockquote>
<p><code>--loader:.ttf=file</code></p>
</blockquote>
</aside>
<p>It turns out I don’t need to adjust my mix.exs file or my config/dev.exs file for the local font to work in my toy example app.  I can just drop the font in my fonts folder, reference it in my CSS file, and I’m done.  So I can get rid of the stuff having to do with the file loader for .ttf files.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="231627" 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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-231627" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="231627"
                     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 #11"></div>
  </section>
</div>
    <div class="postbit" id="231629" data-post-id="231629">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tadasajon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/120/23216_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tadasajon
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Ok, so it turns out that I can entirely delete the <code>priv/static/font</code> directory and the <code>assets/font</code> directory and my toy app still has the American Typewriter font showing up.  Maybe it is cached somewhere?</p>
<p>It seems like in my real app there is nothing I can do to get the American Typewriter font to work, and in my toy app there is nothing I can do to get it to stop working.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="231629" data-batch-url="/posts/batch_likers">
                        0
                      </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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-231629" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="231629"
                     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 #12"></div>
  </section>
</div>
    <div class="postbit" id="231632" data-post-id="231632">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tadasajon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/120/23216_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tadasajon
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>ok, so now I’ve commented out the <span class="mention">@font-face</span> rule in my CSS file and I’ve also deleted the <code>assets/fonts</code> directory and the <code>static/fonts</code> directory, which contained the <code>American_Typewriter_Regular.ttf</code> file.</p>
<p>But the font is showing up fine in my real app (not my toy app).</p>
<p>Before there was nothing I could do to make it work and now there is nothing I can do to break it. So I guess the font got cached somewhere.</p>
<p>But I want to make sure that the font works even if someone’s computer has never seen or heard of this font before, which is why I want to have a copy of the font bundled in my CSS.  This appears to be hard to test because it is difficult to tell where a font is coming from.</p>
<p>I guess the lesson from all this is that playing around with fonts is just a stupid waste of time because there is no way to tell what is going on.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="231632" data-batch-url="/posts/batch_likers">
                        0
                      </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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-231632" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="231632"
                     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 #13"></div>
  </section>
</div>
    <div class="postbit" id="231647" data-post-id="231647">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="axelson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/120/26351_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  axelson
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Scenic Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="tadasajon" data-post="14" data-topic="43791">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/48/23216_2.png" class="avatar"> tadasajon:</div>
<blockquote>
<p>Before there was nothing I could do to make it work and now there is nothing I can do to break it. So I guess the font got cached somewhere.</p>
</blockquote>
</aside>
<p>I can’t help with the esbuild setup but from this it sounds like you installed the font on your computer. I’d recommend uninstalling until you verify that you have your site working.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="231647" data-batch-url="/posts/batch_likers">
                        0
                      </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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-231647" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="231647"
                     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 #14"></div>
  </section>
</div>
    <div class="postbit" id="231707" data-post-id="231707">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tadasajon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/120/23216_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tadasajon
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The solution I have come up with is to just skip all the ESBuild config stuff and manually convert the <code>.ttf</code> files to <code>.woff2</code> and then just manually convert the <code>.woff2</code> files to base64-encoded datauri strings that I manually include in my CSS file.</p>
<p>First, I use this tool to convert <code>.ttf</code> to <code>.woff2</code>: <a href="https://cloudconvert.com/ttf-to-woff2" class="inline-onebox" rel="noopener nofollow ugc">TTF to WOFF2 | CloudConvert</a></p>
<p>Then I use this tool to covert <code>.woff2</code> to a base64-encoded datauri string: <a href="https://hellogreg.github.io/woff2base/" class="inline-onebox" rel="noopener nofollow ugc">Woff2Base: Convert .woff2 to accurate Base64 css.</a></p>
<p>Then I create a <code>/assets/css/fonts.css</code> file and drop the <code>@font-face</code> rules in there, with the entire base64 string included, as follows:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@font-face { 
  font-family: "QuizDrill";
  src: url(data:application/octet-stream;base64,d09GMgABAAAAAHXIABIAAAAiNV/D/f09uyBBZB9W+3ovLSgYkiIYUScoOOMkzfm2/7LYcNpb5clKparZy9oQnYKYSgPwoISWRgs3iJBhX/+ib/4nZm3KxhqQXEcUACUh7T/8s/398//BtL3vL8qXMex/yq3LNP8q8SQUvyVQQT4d/DHVfj/7spNOX/8fzl6irz/pbkO/gdR55B/E35yUwY=);
}
</code></pre>
<p>Note that I have shortened the base64 string in this example because it is thousands (or tens of thousands) of characters long.</p>
<p>Then at the top of my <code>/assets/css/app.css</code> file I have the line:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@import "fonts";
</code></pre>
<p>This allows me to use these local fonts bundled with my CSS.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="231707" data-batch-url="/posts/batch_likers">
                        5
                      </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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-231707" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="231707"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-solved cat-solved" title="Marked as solution"></div>
  </section>
</div>
    <div class="postbit" id="231713" data-post-id="231713">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="outlog" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  outlog
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>can you try this: <a href="https://github.com/phoenixframework/phoenix/commit/19ec3c6991d6c350b2045abe93d52310bbb9f8b9" class="inline-onebox" rel="noopener nofollow ugc">Add external flag to esbuild for fonts and images (#4536) · phoenixframework/phoenix@19ec3c6 · GitHub</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="231713" data-batch-url="/posts/batch_likers">
                        3
                      </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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-231713" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="231713"
                     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 #16"></div>
  </section>
</div>
    <div class="postbit" id="231888" data-post-id="231888">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I recently converted to esbuild (after making an npm update that sent me back down the error rabbit hole), and I was getting these “mark the file as external” errors from esbuild and wondering how I mark the files as external, very excited to try this.</p>
<p>Thank you for sharing <img src="https://forum.elixirforum.com/images/emoji/apple/heart.png?v=15" title=":heart:" class="emoji" alt=":heart:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="231888" 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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-231888" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="231888"
                     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 #17"></div>
  </section>
</div>
    <div class="postbit" id="253277" data-post-id="253277">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I am trying this and is not working.<br>
It needs to put the fonts in some place?<br>
or just convert to this Base64 and put on the CSS file ?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="253277" data-batch-url="/posts/batch_likers">
                        0
                      </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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-253277" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="253277"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="286598" data-post-id="286598">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>We had to remove the <code>format</code> for our code to work. So our CSS looks like this:</p>
<pre data-code-wrap="css"><code class="lang-css">@font-face {
  font-family: 'Sigmar';
  src: url('../fonts/Sigmar-Regular.ttf');
}
</code></pre>
<p>Instead of:</p>
<pre data-code-wrap="css"><code class="lang-css">@font-face {
  font-family: 'Sigmar';
  src: url('../fonts/Sigmar-Regular.ttf') format('ttf');
}
</code></pre>
<p>For some reason adding <code>format</code> to the <code>url</code> broke our font source.</p>
<p>I hope that helps anyone who might experience a similar issue.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="286598" data-batch-url="/posts/batch_likers">
                        4
                      </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-do-i-use-a-custom-font-with-phoenix-1-6-and-esbuild/43791/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-286598" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="286598"
                     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>