docs for default variables #59

Closed
jonschlinkert opened this Issue Feb 19, 2013 · 7 comments

Projects

None yet

2 participants

@jonschlinkert
Member

e.g.

page.title
site.name etc.

@jonschlinkert
Member

{{pages}}
{{page}}
{{ext}}
{{basename}}
{{filename}}

@doowb, any others?

@Arkkimaagi

{{assets}} maybe?

@jonschlinkert
Member

good call lol, that was the most obvious one and of course I forgot it... thanks!

@Arkkimaagi

{{published}}
{{removeHbsWhitespace}}

This is a list I produced by printing options parameter from a helper to my console:

assets: '../..',
categories: [],
currentPage: [...],
data: undefined,
defaultLayout: [Function],
defaultLayoutName: 'default',
engine: 'handlebars',
ext: '',
helpers: 'src/__assemble/helpers/myHelpers.js',
layout: undefined,
layoutName: 'Default',
pageName: 'index.html',
pages: [...],
partials: {},
removeHbsWhitespace: true,
tags: [],
# all partial files that I had, example:
nav: {},
header: {},
# all data files that I had, example:
site: {...},
url: {...}

In the notation above I've replaced some inner data with ... and I have replaced my partials and data files with example code. There may be something that I've added in my environment, but I tried to clean those away.

This is the global scope I think, and as far as I know, currently it's available to the page aswell. Previously we have been talking about the contents of currentPage (that's going to be renamed to page as I heard). But isn't the global scope relevant for documentation also?

I'd prefer to see internal assemble variables under their own namespace as I have mentioned before. Things like removeHbsWhitespace should not pollute the global level. (I know, I added it myself, but I did not know of a better place for it.) Since all the data files and all the partials will populate the same level (as they should, for convenience within the templates), some less needed internal settings could be located to a more safer place. Something like assemble.removeHbsWhitespace or even assemble.engines.handlebars.removeExpressionWhitespace.

@Arkkimaagi

Oh, and of course we have the handlebars internals (..) and helpers from both assemble (100+ helpers) and handlebars(#with, #each, #if ...) that should be listed somewhere probably too.

Sure, they're not variables as such, but pollute the same namespace. (I think)

It would be a nice to have a good reference for all of these, so that new users would not have to dig trough all of them places for the information.

@jonschlinkert
Member

@Arkkimaagi I created this issue so I wouldn't forget to do it, but you got to it before I did! thanks for doing this.

this issue is just focused on getting a list of the variables together for the documentation, but we already started an issues to address the points you're making, so let's punt this discussion over there: #126

isn't the global scope relevant for documentation also?

You and I are on the same page, the helpers need to be addressed in the docs as well (I've already started). I'm going to create an issue for that just to get it started.

We'll make sure all of this gets documented. I have a lot of documentation that I'm trying to get organized so I can push it up, thanks for being patient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment