Skip to content

Commit

Permalink
fix nocache option
Browse files Browse the repository at this point in the history
  • Loading branch information
mgutz committed May 26, 2012
1 parent 01a1a01 commit bbe4dce
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cakefile
Expand Up @@ -10,5 +10,5 @@ task "test", "runs tests", ->
writeHtml = (file, out) ->
# lazily require because funcd may not compile cleanly while developing
Funcd = require(".")
Funcd.renderToFile file, out
Funcd.renderToFile file, out, {nocache: true}

7 changes: 5 additions & 2 deletions lib/funcd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions lib/funcdServerSide.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/lib/funcd.coffee
Expand Up @@ -206,26 +206,31 @@ class Funcd
# @param {object} options The otpions to pass to Funcd.
# @param {Function} template
@renderBuilder: (options, template, args...) ->
args = Array.prototype.slice.call(arguments)
args = [].slice.call(arguments)
first = args[0]

if _.isFunction(first.main)
template = first.main
options = {}
args = args.slice(1)

else if _.isFunction(first)
template = first
options = {}
args = args.slice(1)

else if _.isString(first)
template = require(first)
template = requireEx(first)
if typeof template.main is "function"
template = template.main
options = {}
args = args.slice(1)

else if _.isObject(first)
options = first
template = if _.isFunction(args[1]) then args[1] else requireEx(args[1], options.nocache)
if typeof template.main is "function"
template = template.main
args = args.slice(2)


Expand Down
5 changes: 3 additions & 2 deletions src/lib/funcdServerSide.coffee
Expand Up @@ -25,8 +25,9 @@ Funcd::coffeescript = (options, inner) ->
#
# @param {String} sourceFilename
# @param {String} outFilename
Funcd.renderToFile = (sourceFilename, outFilename) ->
content = Funcd.render(sourceFilename)
Funcd.renderToFile = (sourceFilename, outFilename, options) ->
options ||= {}
content = Funcd.render(options, sourceFilename)
fs.writeFileSync outFilename, content


Expand Down

0 comments on commit bbe4dce

Please sign in to comment.