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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="7stud" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  7stud
                    <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">
								<blockquote>
<p>For me one of the best courses and book that made me switch my brain from Object Orientated Programming to Functional Programming.</p>
</blockquote>
<p>I spent a few years learning erlang before elixir.</p>
<aside class="quote no-group quote-modified" data-username="Exadra37" data-post="8" data-topic="55240">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/exadra37/48/9183_2.png" class="avatar"> Exadra37:</div>
<blockquote>
<p>Book:</p>
<p><a href="https://pragprog.com/titles/elixir16/programming-elixir-1-6/" class="inline-onebox" rel="noopener nofollow ugc">Programming Elixir 1.6: Functional |&gt; Concurrent |&gt; Pragmatic |&gt; Fun by Dave Thomas</a></p>
<p>I would highly recommend to read this book or take the course prior the other Elixir Resources, which I also highly recommend to read after this one.</p>
</blockquote>
</aside>
<p>I’ve already read it.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="285242" 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-jquery-in-a-phoenix-app/55240/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-285242" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285242"
                     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="285243" data-post-id="285243">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="7stud" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  7stud
                    <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="odix67" data-post="7" data-topic="55240">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/odix67/48/19855_2.png" class="avatar"> odix67:</div>
<blockquote>
<p>Personally, I would recommend reading “Elixir in Action” by Sasa Juric, then you may read “Phoenix in Action” to understand the basics of phoenix or go directly to “Programming Phoenix LiveView” by Bruce A. Tate and Sophie DeBenedetto.</p>
</blockquote>
</aside>
<p>I purchased “Elixir in Action” using a discount code on this forum.  I’ve read part of it.    It is very good.   At the same time, I purchased “Phoenix in Action”, and I’m revisiting it now.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="285243" 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-jquery-in-a-phoenix-app/55240/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-285243" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285243"
                     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="285253" data-post-id="285253">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Does your umbrella project happen to be created using an older version of the Phoenix generators?</p><aside class="onebox stackexchange" data-onebox-src="https://stackoverflow.com/questions/70456548/cannot-load-assets-in-phoenix-umbrella-app">
  <header class="source">

      <a href="https://stackoverflow.com/questions/70456548/cannot-load-assets-in-phoenix-umbrella-app" target="_blank" rel="noopener nofollow ugc">stackoverflow.com</a>
  </header>

  <article class="onebox-body">
      <a href="https://stackoverflow.com/users/1337392/flame-phoenix" target="_blank" rel="noopener nofollow ugc">
    <img alt="Flame_Phoenix" src="https://i.sstatic.net/KquuZ.jpg?s=256" class="thumbnail onebox-avatar" width="256" height="256">
  </a>

<h4>
  <a href="https://stackoverflow.com/questions/70456548/cannot-load-assets-in-phoenix-umbrella-app" target="_blank" rel="noopener nofollow ugc">Cannot load assets in Phoenix umbrella app</a>
</h4>

<div class="tags">
  <strong>elixir, phoenix-framework</strong>
</div>

<div class="date">
  asked by
  
  <a href="https://stackoverflow.com/users/1337392/flame-phoenix" target="_blank" rel="noopener nofollow ugc">
    Flame_Phoenix
  </a>
  on <a href="https://stackoverflow.com/questions/70456548/cannot-load-assets-in-phoenix-umbrella-app" target="_blank" rel="noopener nofollow ugc">12:36AM - 23 Dec 21 UTC</a>
</div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="285253" 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-jquery-in-a-phoenix-app/55240/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-285253" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285253"
                     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="285254" data-post-id="285254">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="7stud" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  7stud
                    <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">
								<pre data-code-wrap="elixir"><code class="lang-elixir">% elixir --version
Erlang/OTP 24 [erts-12.3.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Elixir 1.14.4 (compiled with Erlang/OTP 24)
</code></pre>
<p>I’m using Phoenix 1.7.2, which I installed a few days ago with the command:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">$ mix archive.install hex phx_new
</code></pre>
<p><strong>mix.exs</strong>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule MyWeb.MixProject do
  use Mix.Project

  def project do
    [
      app: :my_web,
      version: "0.1.0",
      build_path: "../../_build",
      config_path: "../../config/config.exs",
      deps_path: "../../deps",
      lockfile: "../../mix.lock",
      elixir: "~&gt; 1.14",
      elixirc_paths: elixirc_paths(Mix.env()),
      start_permanent: Mix.env() == :prod,
      aliases: aliases(),
      deps: deps()
    ]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [
      mod: {MyWeb.Application, []},
      extra_applications: [:logger, :runtime_tools]
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [
      {:phoenix, "~&gt; 1.7.2"},
      {:phoenix_html, "~&gt; 3.3"},
      {:phoenix_live_reload, "~&gt; 1.2", only: :dev},
      {:phoenix_live_view, "~&gt; 0.18.16"},
      {:floki, "&gt;= 0.30.0", only: :test},
      {:phoenix_live_dashboard, "~&gt; 0.7.2"},
      {:esbuild, "~&gt; 0.7", runtime: Mix.env() == :dev},
      {:tailwind, "~&gt; 0.2.0", runtime: Mix.env() == :dev},
      {:telemetry_metrics, "~&gt; 0.6"},
      {:telemetry_poller, "~&gt; 1.0"},
      {:gettext, "~&gt; 0.20"},
      {:jason, "~&gt; 1.2"},
      {:plug_cowboy, "~&gt; 2.5"}
    ]
  end

  # Aliases are shortcuts or tasks specific to the current project.
  #
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    [
      setup: ["deps.get", "assets.setup", "assets.build"],
      "assets.setup": ["tailwind.install --if-missing", "esbuild.install --if-missing"],
      "assets.build": ["tailwind default", "esbuild default"],
      "assets.deploy": ["tailwind default --minify", "esbuild default --minify", "phx.digest"]
    ]
  end
end
</code></pre>
<p>I’ll try adding my js file to a non umbrella project and see if I get different results.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="285254" 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-jquery-in-a-phoenix-app/55240/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-285254" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285254"
                     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="285268" data-post-id="285268">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="7stud" data-post="13" data-topic="55240" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/7/57b2e6/48.png" class="avatar"> 7stud:</div>
<blockquote>
<aside class="quote no-group" data-username="odix67" data-post="7" data-topic="55240">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/odix67/48/19855_2.png" class="avatar"> odix67:</div>
<blockquote>
<p>Personally, I would recommend reading “Elixir in Action” by Sasa Juric, then you may read “Phoenix in Action” to understand the basics of phoenix or go directly to “Programming Phoenix LiveView” by Bruce A. Tate and Sophie DeBenedetto.</p>
</blockquote>
</aside>
<p>I purchased “Elixir in Action” using a discount code on this forum. I’ve read part of it. It is very good. At the same time, I purchased “Phoenix in Action”, and I’m revisiting it now.</p>
</blockquote>
</aside>
<p>I also highly recommend Elixir in action, but PragDave is the only one that spends the time to make your mind shift from OOP to FP and thats why I always recommend his book first.</p>
<p>Another excellent book is Real-Time Phoenix by <a class="mention" href="/u/sb8244" rel="nofollow">@sb8244</a>:</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://pragprog.com/titles/sbsockets/real-time-phoenix/">
  <header class="source">

      <a href="https://pragprog.com/titles/sbsockets/real-time-phoenix/" target="_blank" rel="noopener nofollow ugc">pragprog.com</a>
  </header>

  <article class="onebox-body">
    <img width="" height="" src="https://pragprog.com/titles/sbsockets/sbsockets-large.jpg" class="thumbnail" alt="">

<h3><a href="https://pragprog.com/titles/sbsockets/real-time-phoenix/" target="_blank" rel="noopener nofollow ugc">Real-Time Phoenix</a></h3>

  <p>Build and deploy real-time, scalable applications using Phoenix Channels to optimize performance and minimize resource use.</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="285268" 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-jquery-in-a-phoenix-app/55240/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-285268" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285268"
                     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 #15"></div>
  </section>
</div>
    <div class="postbit" id="285280" data-post-id="285280">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="7stud" data-post="11" data-topic="55240">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/7/57b2e6/48.png" class="avatar"> 7stud:</div>
<blockquote>
<p><code>import {hello} from "../vendor/my_functions.js"  </code></p>
</blockquote>
</aside>
<p>This will import <code>hello</code> into the scope of <code>app.js</code>, but will not make it available to the HTML document automatically unless you assign the function to the global <code>window</code> element.</p>
<pre data-code-wrap="js"><code class="lang-js">// file: assets/js/app.js
import {hello} from "../vendor/my_functions.js" 
window.hello = hello
</code></pre>
<p>A good next step would be to namespace your exported functions, then assign that to the global element:</p>
<pre data-code-wrap="js"><code class="lang-js">// file: assets/vendor/my_functions.js
export function hello () {...}
export function etc () {...}

// file: assets/js/app.js
import * as MyFunctions from "../vendor/my_functions.js" 
window.MyFunctions = MyFunctions

// in HTML &lt;script&gt;
window.onload = function () {
  MyFunctions.hello()
  MyFunctions.etc()
}
</code></pre>
<p>This can start to get unwieldy when you have a lot of functionality in multiple HTML scripts.</p>
<p>I would instead move them to <code>app.js</code> and set up your code from there:</p>
<pre data-code-wrap="js"><code class="lang-js">// file: assets/js/app.js
import * as MyFunctions from "../vendor/my_functions.js" 

window.onload = function () {
    MyFunctions.hello()
}

// now this is only necessary if you also want to access them directly from the dev console
window.MyFunctions = MyFunctions
</code></pre>
<p>Lastly, if <code>app.js</code> also gets too large for your liking, or you only want to have certain features running in specific pages, you can move the relevant code to its own module, have <code>esbuild</code> compile it separately, then load it into your page.</p>
<pre data-code-wrap="js"><code class="lang-js">// file: assets/js/my_feature.js
import { hello } from  "../vendor/my_functions.js" 

button = document.querySelector("#someButton")
button.addEventListener("click", () =&gt; { hello() }
</code></pre>
<p>add <code>js/my_feature.js</code> to the esbuild args string (and restart the server to apply changes to config files)</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># file: config/config.exs
config :esbuild,
  version: "0.17.11",
  default: [
    args:
      ~w(js/app.js js/my_feature.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
    cd: Path.expand("../assets", __DIR__),
    env: %{"NODE_PATH" =&gt; Path.expand("../deps", __DIR__)}
  ]
</code></pre>
<pre data-code-wrap="html"><code class="lang-html">&lt;!--- my_page.html.heex or inside render/function component ~H template --&gt;
&lt;script defer phx-track-static type="text/javascript" src={~p"/assets/my_feature.js"}&gt;
&lt;/script&gt;

&lt;button id="someButton" type="button"&gt;Run hello()&lt;/button&gt;
</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="285280" data-batch-url="/posts/batch_likers">
                        7
                      </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-jquery-in-a-phoenix-app/55240/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-285280" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285280"
                     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="285395" data-post-id="285395">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="7stud" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  7stud
                    <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>Hurray!  Clap, clap!  I got all the methods you suggested to work.  Somebody understands scope in javascript!</p>
<p>Out of curiosity, why didn’t my attempts with JQuery work?  I clicked the link:</p>
<p><code>Download the uncompressed, development jQuery 3.6.4</code></p>
<p>and I copied the code and put it in <code>..assets/vendor/jquery.js</code>.</p>
<p>In <code>../assets/js/jquery_setup.js</code>, I have:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">import jQuery from "../vendor/jquery"
window.jQuery = jQuery
window.$ = jQuery
</code></pre>
<p>And, in app.js I have:</p>
<p><code>import "./jquery_setup.js"</code></p>
<p>But, in my browser I get an error in the js console that says <code>$</code> isn’t recognized.  I looked through the jQuery code, and I don’t think it exports “jQuery” or “$”.  If it would take too much time to figure out, don’t bother.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="285395" 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-jquery-in-a-phoenix-app/55240/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-285395" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285395"
                     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="285397" data-post-id="285397">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="7stud" data-post="18" data-topic="55240">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/7/57b2e6/48.png" class="avatar"> 7stud:</div>
<blockquote>
<p>In <code>../assets/js/jquery_setup.js</code>, I have:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">import jQuery from "../vendor/jquery"
window.jQuery = jQuery
window.$ = jQuery
</code></pre>
<p>And, in app.js I have:</p>
<p><code>import "./jquery_setup.js"</code></p>
</blockquote>
</aside>
<p>That’s a very good question. This style is a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#import_a_module_for_its_side_effects_only" rel="noopener nofollow ugc">side effect only</a> type of import that should run the script’s global code. <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"></p>
<p>Maybe try to compile it separately in the esbuild args string and import it as a separate asset in the HTML head, and skip the extra step through <code>app.js</code>?</p>
<p>Or just straight-up inline the <code>jquery_setup.js</code> code in <code>app.js</code>?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="285397" 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-jquery-in-a-phoenix-app/55240/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-285397" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285397"
                     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="285562" data-post-id="285562">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="7stud" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  7stud
                    <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>I couldn’t get jQuery to work.   Thanks for your help.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="285562" 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-jquery-in-a-phoenix-app/55240/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-285562" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="285562"
                     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>