title: How to include external .js file to ejs Node template page
body: <p>I cannot find a way to include external .js file to Node ejs template. I want to put logic and data into object in external .js file, include that file to index.ejs template and pull data from it.</p>
  
  <p>I tried by inserting standard way
  <code>&lt;script src="sample.js"&gt;&lt;/script&gt;</code>, and it doesn't work</p>
  
  <p>Then I tried ejs specific keyword <code>&lt;% include partials/sample.js %&gt;</code> and this works only for adding partials (ejs code snippets).</p>
  
  <p>I inserted .js file into static directory which is defined in executable server.js, no results again.</p>
  
  <p>But interestingly, including css file into ejs template classic way works fine, for example</p>
  
  <pre><code>&lt;link href="/assets/styles.css" rel="stylesheet" type="text/css" /&gt;
  </code></pre>
  
  <p>Workaround would be to include external ejs file where I would put logic and data inside &lt;% %> tags, but this is obviously a patch and not a viable solution, because ejs is not a js file. Besides, it doesn't work.</p>
  
  <p>I cannot find any solution on Internet. Any hint?</p>
  
  <p>Thanks</p>