Permalink
Browse files

exposed str_render function; added support for consolidate.js

  • Loading branch information...
malgorithms committed Nov 6, 2012
1 parent 8ee89cf commit 0856d5fa3d711988cd0517d54f6c6fe954143297
Showing with 27 additions and 15 deletions.
  1. +11 −6 index.coffee
  2. +16 −9 index.js
View
@@ -10,20 +10,25 @@ exports.expressEngine = e
# a pretty name for general usage
exports.render = e.run
-# express 3.x support; by default, caching is on
+# express 3.x support;
__express = exports.__express = (filename, options, cb) ->
- cache = if options.cache? then options.cache else true
- eng = if options.cache then e else new engine { prettyPrintErrors: true }
- eng.run filename, options, (err, res) ->
+ e.run filename, options, (err, res) ->
if err
cb new Error(err)
else
cb null, res
# consolidate.js support, which doesn't want caching on by default
exports.__consolidate_engine_render = (filename, options, cb) ->
- if not options.cache? then options.cache = false
- __express filename, options, cb
+ if (options.cache?) and options.cache
+ eng = e
+ else
+ eng = new engine { verbose: false, prettyPrintErrors: true }
+ eng.run filename, options, (err, res) ->
+ if err
+ cb new Error(err)
+ else
+ cb null, res
# consolidate.js wants this, but it might generally be useful
exports.str_render = (template_str, options, cb) ->
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 0856d5f

Please sign in to comment.