How to add page specific scripts using nunjucks and express app?
<p>Suppose i have some scripts which are common for all the pages and some scripts which are required only on specific page what is the efficient way to implement this using nunjucks as template engine and express 4 as the framework on backend.</p>

<pre><code>--- site
 --- public
  |___js
    |___ script.js (for all pages)
    |___ home.js (only required on home page)
    |___ contact.js (contact page)
    |___ search.js  (on search page)
</code></pre>

<p>I have tried to use express locals for passing in the page title and sending the array of common scripts + home.js but on rendering script tags theres another call made to express middleware for route (*) which resets the scripts to common as no page title is passed to the function. </p>