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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Awesome! Thanks; will read it today and let you know if I have any feedback. Thanks for writing this up, most useful…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="67630" 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/phoenixframework-http-2/1089/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-67630" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="67630"
                     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 #21"></div>
  </section>
</div>
    <div class="postbit" id="67654" data-post-id="67654">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Let me know specifically if there are any areas that I’m glossing over, especially with the JS stuff.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="67654" 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/phoenixframework-http-2/1089/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-67654" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="67654"
                     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 #22"></div>
  </section>
</div>
    <div class="postbit" id="67992" data-post-id="67992">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/chasegilliam" rel="nofollow">@ChaseGilliam</a> is there a reason why webpack is run as a server instead of emitting static js? Is that related to the bit at the end:</p>
<blockquote>
<p>I’ll leave it as an exercise for readers to explore pushing multiple js files to the client and combining Webpack’s lazy loading to push files on demand.</p>
</blockquote>
<p>If so could you elaborate on that?</p>
<p>Minus webpack, as far as I can tell all thats needed to enable http2 is the updated deps, the cert, and the changed https endpoint config. Neat!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="67992" 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/phoenixframework-http-2/1089/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-67992" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="67992"
                     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 #23"></div>
  </section>
</div>
    <div class="postbit" id="68018" data-post-id="68018">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>why webpack is run as a server instead of emitting static js</p>
</blockquote>
<p>This is just in development mode so that you can make use of code reloading. For production you would use <code>webpack -p</code> or similar to build production assets.</p>
<blockquote>
<p>Minus webpack, as far as I can tell all thats needed to enable http2 is the updated deps, the cert, and the changed https endpoint config.</p>
</blockquote>
<p>Right, that’s basically the minimal set of requirements. However, webpack gives you nice tools for splitting your JavaScriot into N small files. This helps you leverage HTTP/s’s multiplexing. I didn’t want to go into too much detail on that point, because Webpack 4 will have some major changes, and I want to revisit the topic once their ecosystem has transitioned to their new APIs.</p>
<p>Also, thanks for checking out the guide!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="68018" data-batch-url="/posts/batch_likers">
                        2
                      </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/phoenixframework-http-2/1089/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-68018" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="68018"
                     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 #24"></div>
  </section>
</div>
    <div class="postbit" id="68467" data-post-id="68467">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>i’ve been reading up on http2 push and it needs to be initiated from server. Can you tell me what you were thinking about regarding webpack lazy load and push?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="68467" 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/phoenixframework-http-2/1089/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-68467" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="68467"
                     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 #25"></div>
  </section>
</div>
    <div class="postbit" id="68468" data-post-id="68468">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Webpack’s lazy load is well suited to pulling js on an as needed basis, but I suppose you could you it for push, I’m just not sure how. In general I’m still thinking through how best use push with Phoenix, and when to use that vs. channels/web sockets.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="68468" 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/phoenixframework-http-2/1089/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-68468" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="68468"
                     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 #26"></div>
  </section>
</div>
    <div class="postbit" id="68497" data-post-id="68497">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<pre data-code-wrap="elixir"><code class="lang-elixir">  defmodule Http2TodayWeb.LayoutView do
    use Http2TodayWeb, :view
    def js_script_tag do
      if Mix.env == :prod do
        # In production we'll just reference the file
        """
        &lt;script src="&lt;%= static_path(@conn, "/js/vendor.js") %&gt;"&gt;&lt;/script&gt;
        &lt;script src="&lt;%= static_path(@conn, "/js/app.js") %&gt;"&gt;&lt;/script&gt;
        """
      else
        # In development mode we'll load it from our webpack dev server
        """
        &lt;script src="https://localhost:8080/vendor.js"&gt;&lt;/script&gt;
        &lt;script src="https://localhost:8080/app.js"&gt;&lt;/script&gt;
        """
      end
    end

    # Ditto for the css
    def css_link_tag do
      if Mix.env == :prod do
        "&lt;link rel=\"stylesheet\" href=\"&lt;%= static_path(@conn, \"/css/app.css\") %&gt;" 
      else
        "&lt;link rel=\"stylesheet\" type=\"text/css\" href=\"https://localhost:8080/css/app.css\" /&gt;"
      end
    end
  end
</code></pre>
<p>can be somewhat optimized if you move <code>if</code> outside of the function</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  defmodule Http2TodayWeb.LayoutView do
    use Http2TodayWeb, :view

    js_script_tag = 
      if Mix.env == :prod do
        # In production we'll just reference the file
        """
        &lt;script src="&lt;%= static_path(Http2TodayWeb.Endpoint, "/js/vendor.js") %&gt;"&gt;&lt;/script&gt;
        &lt;script src="&lt;%= static_path(Http2TodayWeb.Endpoint, "/js/app.js") %&gt;"&gt;&lt;/script&gt;
        """
      else
        # In development mode we'll load it from our webpack dev server
        """
        &lt;script src="https://localhost:8080/vendor.js"&gt;&lt;/script&gt;
        &lt;script src="https://localhost:8080/app.js"&gt;&lt;/script&gt;
        """
      end
    
    def js_script_tag, do: unquote(js_script_tag)

    # Ditto for the css
    css_link_tag = 
      if Mix.env == :prod do
        "&lt;link rel=\"stylesheet\" href=\"&lt;%= static_path(Http2TodayWeb.Endpoint, \"/css/app.css\") %&gt;" 
      else
        "&lt;link rel=\"stylesheet\" type=\"text/css\" href=\"https://localhost:8080/css/app.css\" /&gt;"
      end
    
    def css_link_tag, do: unquote(css_link_tag)
  end
</code></pre>
<p>if you care about small performance gains …</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="68497" 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/phoenixframework-http-2/1089/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-68497" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="68497"
                     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 #27"></div>
  </section>
</div>
    <div class="postbit" id="68503" data-post-id="68503">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                    <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="idi527" data-post="28" data-topic="1089">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/i/85e7bf/48.png" class="avatar"> idi527:</div>
<blockquote>
<p>if you care about small performance gains …</p>
</blockquote>
</aside>
<p>Not just a performance cain, but you want to keep <code>Mix.*</code> calls outside of function calls so they stay at compile-time only.  If you deploy a release then Mix will not exist (it’s a build system after all) so that would crash if inside a function (you can <code>unquote</code> it to move it outside the function if necessary).  ^.^</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="68503" 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/phoenixframework-http-2/1089/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-68503" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="68503"
                     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 #28"></div>
  </section>
</div>
    <div class="postbit" id="68513" data-post-id="68513">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yeah, that’s much more important, didn’t think of that …</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="68513" 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/phoenixframework-http-2/1089/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-68513" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="68513"
                     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 #29"></div>
  </section>
</div>
    <div class="postbit" id="68514" data-post-id="68514">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/idi527" rel="nofollow">@idi527</a> and <a class="mention" href="/u/overminddl1" rel="nofollow">@OvermindDL1</a>, that’s a great point. I’ll make a note and update the post soon.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="68514" 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/phoenixframework-http-2/1089/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-68514" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="68514"
                     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 #30"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/1089/load_more?page=4">Load more posts (20 remaining)</a>
</div></template></turbo-stream>