title: Nodejs EJS partials with scripts in the head
body: <p>I'm working with EJS to render and server HTML pages from a Nodejs server. Some of the partials I include have scripts and stylesheets referenced in the head, but this causes the client to make multiple requests for the same file (for example if the parent view also includes that file)</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;!-- file: parent.ejs --&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;link rel="stylesheet" href="public/mystylesheet.css"&gt;
          &lt;script src="public/myscript.js"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;%- partial("partial.ejs") %&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And in the partial:</p>
  
  <pre><code>&lt;!-- file: partial.ejs --&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;link rel="stylesheet" href="public/mystylesheet.css"&gt;
          &lt;script src="public/myscript.js"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          This is an EJS partial!
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In this case, "mystylesheet.css" is loaded by the client twice (unnecessarily), and so is "myscript.js"</p>
  
  <p>Is there an easy way (preferably using EJS) to make sure that a stylesheet or script is included when a partial requires it, but not if the parent view already has included the resource?</p>