Adds a create() method to the Handlebars object which will generate a new instance of Handlebars in node.js. The npm test is passing. I am not sure how the browser version is tested. Please let me know if there are any issues or feedback.
I really love the interfaces and DI hooks in handlebars. We are moving to it for our main rendering engine. Our company hosts a couple hundred sites and the singleton pattern is blocking our migration. Ideally, I would love to have this merged to core and published to npm sooner rather than later. If this is not possible, then we'll run from our fork in the near term.
I am here to help with anything. Please le me know if there is anything I can do to help.
Commiting initial factory code
Finished factory pattern
This pull request passes (merged eccc7c3 into 89f5ab8).
We should drop the tab indent at minimum for all of the content in between the BROWSER comments as this is going to impact non-node users (this adds a slight cost for node comprehension but if the dev is familiar with the BROWSER parsing that is done on the files it shouldn't be a concern).
After that there are a few places that I think need to be looked at for impact in browser land but can't do line-by-line comments on ?w=1 mode so will come back after the tabs are dropped back.
The tab indendation in aprox. all files confuses what the real changes are.
I'll spend some time to remove the extra tabs so that it is easier to see what changed.
I also just re-read some of the code and I am pretty sure that I broke something on the client side package. I need to figure out how to run the client side unit tests.
I second this request. This is indispensable to avoid race conditions if you have helpers that need data specific to the request.
@tommydudebreaux any progress here?
Sorry for going dark. My fork has been sufficient for delivering some projects. I can update the formatting. Just so I understand, we want 2 spaces and no tabs. Yes?
FWIW- I published this to npm so we could move forward with our other work a while back.
I am going update the formatting this weekend
@tommydudebreaux I think on my initial review https://github.com/wycats/handlebars.js/pull/300/files?w=1#L1L1 seemed suspect WRT the client-side changes.
The rake tests are going to be the closest to the the client environment and the npm test tests are going to be representative of the node environment.
2 spaces, no tabs. And I'd argue for not indenting the BROWSER sections of code to match the node logic as this makes for weird output in the non-minimized client code, more diff changes here, and generally I don't think we should be going for node only features when implementing things here so the amount of node specific code should hopefully be small.
Factory update with tabs to spaces.. sorry :(
Merged upstream master and ran unit tests
Man.. I finally got a second to update this today. In addition to spacing, I pulled latest upstream/master, merged it, and insured the tests are still passing.
This causes a few module variables to be promoted to globals in the browser version. We need to make sure that we maintain this module scope.
This is still an open issue. These vars will not be exposed as globals where they were previously not:
var toString = Object.prototype.toString, functionType = "[object Function]";
I'm looking into this now as I need to push a release for rc3.
nit: Can we maintain the prior formatting here?
So you just want this section un-indented?
Two options here. Restore the function scope so the verifyMatch vare is not escaped as a global or inline it in the BlockNode instance. For the sake of clarity on this specific PR the former might be better.
What needs to be done to get this guy merged?
Can we get together a list of things that need to happen to merge this?
It is stable on my end and we have been running it in production with client and server rendering for months via these published repos. I would love to have this as part of the core.
I think my only concerns right now are changes to the scopes on the client side that it seems like this introduced. If we can restore the scoping on the base and ast files in the client portion of the code I think we will be in a good place.
restored scope of var verifyMatch
Sorry for delay on knocking this out. Been super busy with work and new baby... Anyways, so the verifyMatch function is inlined now. I also merge upstream and ensured tests pass.
Crossing fingers we are good now. :)