title: Node.js module-specific static resources
body: <p>Is there an elegant way to bundle static client-side file resources (scripts,images,etc) into an Express module and systematically avoid naming conflicts?  It's easy enough to register a module-specific instance of the static object like so:</p>
  
  <pre><code>app.use(express.static(modulePath + '/public'));
  app.use(express.static(__dirname + '/public'));
  </code></pre>
  
  <p>but if both directories contain a "styles.css" file, it would seem that the one from the module will eclipse the one for the application.  A subdirectory within the module's public could be used to avoid this problem, but what I really want is a way to map the module's resources to an arbitrary path such that</p>
  
  <pre><code>http://localhost:3000/mymodule/styles.css =&gt; &lt;modulePath&gt;/public/styles.css
  http://localhost:3000/styles.css =&gt; &lt;appPath&gt;/public/styles.css
  </code></pre>
  
  <p>Is there already a way to do this?  I've already done it with coding tricks, so I'm really looking for the recommended way to get it done.  Also, if I'm missing some key concept that makes this totally unnecessary, I would like to learn about that too.</p>