title: Using piler with express 3 and nodejs
body: <p>I want to run Express 3.3.x with its default implementation.
  Express uses its routes module, so what I have to do, if JS and CSS is accessible by any view in any route?</p>
  
  <pre><code>/**
   * Module dependencies.
   */
  var express = require('express');
  var http = require('http');
  var path = require('path');
  
  var piler = require('piler');
  
  var mongoose = require('mongoose');
  
  var config = require('./config');
  
  var app = exports.app = express();
  var js =  piler.createJSManager();
  var css = piler.createCSSManager();
  var srv = require('http').createServer(app);
  
  // all environments
  js.bind(app,srv);
  css.bind(app,srv);
  
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.cookieParser('your secret here'));
  app.use(express.session());
  app.use(app.router);
  app.use(require('less-middleware')({ src: __dirname + '/public' }));
  app.use(express.static(path.join(__dirname, 'public')));
  
  js.addUrl("http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js");
  
  // development only
  if ('development' == app.get('env')) {
    app.use(express.errorHandler());
  }
  
  /**
   * Routes
   */
  var routes = require('./routes');
  app.get('/', routes.index);
  
  srv.listen(app.get('port'), function(){
    console.log('Express server listening on port ' + app.get('port'));
  });
  </code></pre>
  
  <p>In the example of piler:</p>
  
  <pre><code>app.get("/", function(req, res){
      res.render("index.jade", {
          layout: false,
          js: js.renderTags(),
          css: css.renderTags()
      });
  });
  </code></pre>
  
  <p>This works. But I have</p>
  
  <pre><code>app.get('/', routes.index);
  </code></pre>
  
  <p>So what I have to do, that js.renderTags() works in every view?</p>