Open dtothefp opened 8 years ago
@dtothefp Thanks for the issue! If you're reporting a bug, please be sure to include:
assemble
you are using.@dtothefp inside node_modules in assemble-render-file
try commenting out the code that creates the ctx
object, then just pass locals
to render. See if that works. If so we can update that lib. (was just talking to @doowb, he mentioned this)
@jonschlinkert when I do that looks like locals
is sometimes undefined
which causes an error
// create the context to pass to templates
//var ctx = utils.merge({}, app.cache.data, locals, file.data);
//ctx.engine = engine || ctx.engine;
// render the file
app.render(file, locals, function(err, res) { //...
/Users/davidfox-powell/dev/prerender-demo/node_modules/assemble-core/node_modules/templates/lib/utils/proto.js:105
var engine = locals.engine || view.engine || opts.engine;
^
TypeError: Cannot read property 'engine' of undefined
you probably need to do something like if (!locals) locals = {}
Demo repo here: https://github.com/dtothefp/assemble-yfm-nunj
"version": "0.8.0"
Essentially, overwritting pre-existing data on thefile.data
context does not seem to work inpreRender
hookif
app.cache.data.title
orfile.data.title
exists then the above doesn't work. I solve this by doing merge inonLoad
or by making a stream plugin