mattacular / grunt-handlebars-compiler

Grunt.js task to precompile Handlebars.js templates with the same options as the CLI utility
MIT License
12 stars 12 forks source link

Does not work with handlebars-v2.0.0 #12

Closed alexef closed 9 years ago

alexef commented 10 years ago

Latest release of handlebars breaks template compatibility with v1.3.0

TheSisb commented 10 years ago

Just noticed this as well. Any ideas how to fix it? Still trying to remember how I had set this up so long ago haha

mattacular commented 10 years ago

I haven't had a chance to get familiar with Handlebars 2.0. Sorry! I haven't forgotten about this issue, I just haven't had time to look into it yet. I don't use v2.0 personally yet so it's hard to keep it high on my list of priorities.

I'll certainly welcome a PR if anyone wants to take a stab at figuring it out though!

mattacular commented 10 years ago

Oops didn't mean to close. Re-opening.

TheSisb commented 10 years ago

Ok I got it to work. Really easy actually haha. I'll post a write-up / pull request soon

TheSisb commented 10 years ago

Ok all you really need to do is:

So the only change really is changing the package.json to 2.0.0

mattacular commented 10 years ago

Is this expected to break compatibility with <2.0 Handlebars?

mattacular commented 10 years ago

Also thank you for looking into it!

TheSisb commented 10 years ago

Yeah.

"Precompiler output has changed, which means your 1.x precompiled templates would not be compatible with Handlebars 2.x runtime, as well as 2.x runtime will be not compatible with old templates. You should update precompiler, update runtime and update all templates."

"Partials no longer have access to parent context (../), but now can accept hash as argument and has access to the root context through @root variable. So look at your partials for using ../ and change it to using local data, passed to partial as argument."

Source: http://stackoverflow.com/questions/24662703/what-are-the-differences-between-the-handlebars-1-x-and-2-x-apis

mattacular commented 9 years ago

We are going to be finally merging this update very soon. There is an open pull request if you want to help test please leave comments there. Closing issue. Sorry for the very long wait time! I no longer use this myself so it has fallen to the bottom of my ever-growing to-do list.