node.js - templateData variables return undefined from helper function (docpad.coffee configuration file) -


this configuration file.

docpadconfig = {     templatedata:         site:             title: 'hello docpad'          gettitle: ->             @site.title          getstring: ->             'just string' }  # export docpad configuration module.exports = docpadconfig 

from jade layout when title= site.title renders ok. when try call helper function title= gettitle() console outputs this:

error: error occured: referenceerror: /volumes/data/project/am/lab/docpad/hello_docpad/src/layouts/default.html.jade:21     19|     20|     //- our site title , description   > 21|     title= gettitle()     22|     23|     //- output docpad produced meta elements     24|     != getblock('meta').tohtml()  site not defined     @ docpadconfig.templatedata.getwat (/volumes/data/project/am/lab/docpad/hello_docpad/docpad.coffee:10:16)     @ eval (eval @ <anonymous> (/volumes/data/project/am/lab/docpad/hello_docpad/node_modules/docpad-plugin-jade/node_modules/jade/lib/jade.js:170:8), <anonymous>:47:64) 

looks can't access site object inside helper function.

i'm sure i'm missing trivial, maybe plugin needed this... can't find out "wat" wrong here.

i've found solution looking similar issue in docpad skeleton. relates bug in jade pre-processor.

update "docpad-plugin-jade": "~2.4.1" fixes issue.


Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

mouseevent - Catch mouse event on tree widget item in QTreeWidget -

Java JSoup error fetching URL -