title: Pass script src into Pug template
body: <p>I'm trying to get my Pug template to render a script using Express. My file structure is as follows:</p>
  
  <pre><code>views
      public
          index.jade
          main.js
  
  index.js
  </code></pre>
  
  <p>I have tried passing the name of the script as an argument to <code>res.render('public/index', { bundle: '/main.js' })</code> with no luck.</p>
  
  <p>Contents of my <code>index.js</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>const app = express();
  
  app.set('view engine', 'jade');
  
  app.use(express.static(path.join(__dirname, 'views/public')));
  
  app.use('*', (req, res, next) =&gt; {
      res.render('public/index', { bundle: '/main.js' });
  });
  </code></pre>
  
  <p>Contents of my <code>index.jade</code>:</p>
  
  <pre><code>doctype html
  html
      head
          title SSR React
      body
          div#root
          script(src='#{bundle}')
  </code></pre>
  
  <p>I'm getting a strange error in the console. The name of the script is coming through, but I'm getting the error</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token &lt;</p>
  </blockquote>
  
  <p>The contents of <code>main.js</code> when I look at the console are as follows:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;SSR React&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;div id="root"&gt;&lt;/div&gt;&lt;script src="/main.js"&gt;&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>so, just the minified HTML which is being transpiled from Pug.</p>
  
  <p>Can anyone shed some light here? Am I configuring Express incorrectly? Thanks.</p>