title: Routes and scripts in Express (using Jade) - scripts on layout.jade
body: <p>I am new to Node, Express, and Jade, and have a question about how to structure my script files.</p>
  
  <p>In my layout I have jquery listed at the bottom. In another file, on another route, I wanted to add a script that uses jquery, so I wanted to add it below the jquery script tag on layout.jade when using that particular route.</p>
  
  <p>layout.jade:</p>
  
  <pre><code>doctype html
  html
    head
      title= title
      link(rel='stylesheet', href='/stylesheets/happy.css')
      link(rel='stylesheet', href='/stylesheets/fonts.css')
      link(href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600', rel='stylesheet', type='text/css')
      link(href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600', rel='stylesheet', type='text/css')
      link(href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet")
      link(rel="icon" href="/favicon.png" sizes="16x16" type="image/png")
    body
      block content
      script(src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js')
      script(src="/javascripts/script.js")
  </code></pre>
  
  <p>I want this file added to the bottom of my scripts on the layout page when visting the /about route:</p>
  
  <pre><code>script(src="/javascripts/scroll.js")
  </code></pre>
  
  <p>/routes/about.js:</p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  
  router.get('/', function(req, res) {
    res.render('about');
  });
  
  module.exports = router;
  </code></pre>
  
  <p>from app.js:</p>
  
  <pre><code>app.use('/about', about);
  </code></pre>