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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="gus" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/gus/120/37315_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  gus
                    <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 class="user-title">
									<span>Nerves Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks, this worked! Though for future reference, in case anyone else needs this solution, I think it is better to use the minified css file, found in <code>../node_modules/simplemde/dist/simplemde.min.css</code>. There were some formatting issues that I think came from dependencies on other packages’ css declarations that was solved by using the .min.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="123304" 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/basics-for-using-npm-modules-in-phoenix-1-4-application/21458/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-123304" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="123304"
                     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="123305" data-post-id="123305">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="gus" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/gus/120/37315_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  gus
                    <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 class="user-title">
									<span>Nerves Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="adrianrl" data-post="10" data-topic="21458">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/adrianrl/48/7182_2.png" class="avatar"> adrianrl:</div>
<blockquote>
<p>Typically with inline JavaScript you initialize / configure dependencies that are pulled from a CDN, because by default, Webpack will assume you have that dependency installed locally. When you use a library from a CDN it exposes a global object (SimpleMDE, React, ReactDOM…), that’s why you can configure it using inline JavaScript.</p>
</blockquote>
</aside>
<p>Ohh this makes sense. So if I want to continue trying to use the local module, then I should go ahead and create a separate file (say <code>editor.js</code>) that then is included via script tag with a src attribute?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="123305" 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/basics-for-using-npm-modules-in-phoenix-1-4-application/21458/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-123305" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="123305"
                     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="123307" data-post-id="123307">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Exactly! You do need to generate another bundle, so you must create another entry in the Webpack configuration, like this:</p>
<pre data-code-wrap="javascript"><code class="lang-javascript">entry: {
  './js/app.js': ['./js/app.js'].concat(glob.sync('./vendor/**/*.js')),
  'simplemde_bundle': ['./js/editor.js'] // The key would be the name of the output
},
</code></pre>
<p>Then inside <code>editor.js</code>:</p>
<pre data-code-wrap="javascript"><code class="lang-javascript">import SimpleMDE from 'simplemde'; // Include the dependency

SimpleMDE({ blah: 'blah' }); // and configure the object
</code></pre>
<p>Lastly include the script only when you need it:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">&lt;script src="&lt;%= Routes.static_path(@conn, "/js/simplemde_bundle.js") %&gt;"&gt;&lt;/script&gt;
</code></pre>
<p>Please remember to include the script <em>below</em> the element (I’ll assume a <code>textarea</code>), otherwise it won’t find where to use its magic. I can’t test the code, but this will guide you in the right direction, the CSS should be included inside the script too.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="123307" 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/basics-for-using-npm-modules-in-phoenix-1-4-application/21458/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-123307" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="123307"
                     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>