shannonmoeller / gulp-hb

A sane Gulp plugin to compile Handlebars templates. Useful as a static site generator.

Home Page:http://npm.im/gulp-hb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clarify what should be output with debug?

mmilano opened this issue · comments

hi,
trying and struggling to use gulp-hb and your associated handlebars-layout (hb-layout?).
w/r/t gulp-hb,
can you add more clarification and detail to what the debug parameter will do, and what the contents of the various out sections should display?

in particular:

  • some references suggest that debug takes only true/false, while some discussion threads indicate 1 or 2 as passable values.
  • what should be appearing in the debug output category of local data? files specific to that main file, or data declared in the file?
  • "blockHelperMissing" and "helperMissing" feel like err, but what exactly is missing?

thanks.

right now, a run will give me something like this:

pages/project.html
    global data:
      Volumes        site           sitePortfolio  
    local data:
      
    decorators:
      inline  
    helpers:
      blockHelperMissing  helperMissing       log                 unless              
      each                if                  lookup              with                
    partials:
      project-a            project-css             project-header               project-section-heading-4  
      project-figure               project-font            project-js                   
      project-ico             project-section-heading-2  
      project-foor               project-meta            project-section-heading-3  

The purpose of the debug flag is to give a quick glimpse into the state of Handlebars when a file is rendered. This can be useful to tell if a glob pattern has converted into the state you expect to be there when writing your templates.

debug

The debug flag can be a Boolean or a Number:

  • 0 and false are equivalent
  • 1 and true are equivalent
  • 2 will output the same as 1 and true plus glob-matching debug information. Very noisy, rarely needed, but there if you want it.

When the debug flag is not 0 or false, gulp-hb will log the top-level object keys (like your example) for pertinent internal Handlebars objects where the list is the result of running Object.keys(handlebars[property]):

global data

Top-level object keys of data that was registered using hb({ data: ... }) or the .data() method. Gives you a sense of what you can access at the root-level of your templates using {{foo}} or {{@global.foo}}. In your case you'd be able to access {{site}}, {{@global.sitePortfolio}}, etc.

local data

Top-level object keys of data passed into the template at render time. This will be the file.data property if it exists. Gives you a sense of what you can access at the local-level of your templates using {{foo}} or {{@local.foo}}. In your case, you haven't used a plugin to populate the file.data property.

decorators, helpers, and partials

Top-level object keys of Handlebars registries. Same as Object.keys(handlebars.partials) to list registered partials for example. The blockHelperMissing and helperMissing helpers are not errors, but are default internal Handlebars helpers.


The handlebars-layouts module is separate, though, as the author, I often include it. :)

thank you!

Of course!