     filename = _.trim _.trim(contents.substring(start, end), '"'), "'"
     filename = process.cwd() + @publicDir + '/' + filename.replace /^\//, ''
     mime = mimes[path.extname filename]
-    
-    if mime?    
+
+    if mime?
       if fs.existsSync filename
         base64Str = fs.readFileSync(path.resolve filename).toString('base64')
-      
+
         newUrl = "data:#{mime};base64,#{base64Str}"
         contents = _.splice(contents, start, end - start, newUrl)
         end = start + newUrl.length + 4

      writeFile filename, contents
      if @gzip then gzipPkg(contents, filename, callback) else callback()
      total++
      
  if @assets.jst?
    for pkg, files of @assets.jst
      contents = generateJSTs pkg
      contents = @_tmplPrefix + contents
      contents = uglify contents if @mode is 'production'
      fingerprint = '-' + fingerprintForPkg('jst', pkg) if @mode is 'production'
      filename = "#{pkg}#{fingerprint ? ''}.jst.js"
      writeFile filename , contents
      if @gzip then gzipPkg(contents, filename, callback) else callback()
      total++

# Instead of compiling & writing the packages to disk, nap will compile and serve the files in 
# memory per request.

module.exports.middleware = (req, res, next) =>
  
  unless @mode is 'development'
    next()
    return
  
  @usingMiddleware = true

  switch path.extname req.url
  
    when '.css'
      res.setHeader?("Content-Type", "text/css")
      for pkg, filenames of @assets.css


    when '.js'
      res.setHeader?("Content-Type", "application/javascript")

      if req.url.match /\.jst\.js$/
        pkg = path.basename req.url, '.jst.js'
        res.end generateJSTs pkg
