Update Handlebars command-line Example to use yhandlebars #229

wants to merge 1 commit into


None yet
4 participants

Using the handlebars.js command-line application to precompile templates in a build process brings some trouble to your use function.

I customized the handlebars.js command-line application to use YUI Handlebars to precompile templates and render them to a YUI module which requires handlebars-base. This cleans up the use function nicely.

To fit with Loader it creates a raw .js, a debug -debug.js and a minificated -min.js version when outputted to a file.


ericf commented Aug 24, 2012

@clickholddrag Cool!

Thinking ahead here… @davglass is currently working on a better build system for YUI, Shifter, I'm wondering if it makes sense to add what is essentially yhandlebars as a task to Shifter. What do you think?

@ericf Great idea!

I also thought about implementing it as a task to ybuild and have it precompile templates on a module basis. I think it could be useful to place templates of a View in the modules folder and have it processed during build, like it is with assets or lang folders.

I will definetly look into Shifter and see if it can replace YUI Builder for me now. Do you already use it in production?

Apart from that i think that a standalone solution like yhandlebars can be useful to people in the meantime.


davglass commented Aug 24, 2012

Before we change our docs to use your tool, can you please add a
License file so that our users know the license before being required
to install it?


@davglass Sure!

I added an MIT-License to the package.


ericf commented Aug 24, 2012

I would still prefer that we don't remove the old docs which mention using the handlebars CLI, but instead modify them to include yhandlebars as another option.


evocateur commented Aug 29, 2012

We're using a very similar module I wrote called mustache-wax to do the same thing at Zillow. I am a little leery of advocating usage of a module (such as yhandlebars) without a single unit test.

I'm very interested in Shifter, though. I could see moving this functionality into a gear-lib and employing it via Shifter. (or @rgrove's newest proposal davglass/shifter#11 :D)


ericf commented Oct 11, 2012

@clickholddrag I'm waiting for a response to my comment above.

@ericf Sorry for the long time off. In the meantime I installed shifter and used it heavily. I definetly think it is the perfect place for template precompilation. By now I precompile my templates with yhandlebars via an exec task in shifter. However, this feels kind of like a hack to me. As soon as I have some time left I will think about a contribution to shifter regarding this topic. I see that this is on peoples minds already and I like the direction that @rgrove’s proposal in yui/shifter#11 is heading for.

I can also see your point regarding this pull request. Maybe it really would be the best idea to not touch the handlebars example and instead just give a short reference to mustache-wax and yhandlebars until they become obsolete because of shifter’s built in template precompilation?


ericf commented Oct 18, 2012

Okay, let's move in the direction us using a Shifter task do this work. @clickholddrag or @evocateur feel free to take lead on adding that to Shifter.

ericf closed this Oct 18, 2012

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