cmather / meteor-handlebars-server

Server side handlebars support for Meteor
80 stars 14 forks source link

Upgraded - 1.1.0 and client side issues #7

Closed wbashir closed 11 years ago

wbashir commented 11 years ago

I upgraded to make this work with the latest version of meteor but now i get client side errors. From my console..

Uncaught ReferenceError: OriginalHandlebars is not defined

This is from the templates that get created, by the way, why are these even accessible on the client ?

wbashir commented 11 years ago

Any word on this, i still receive this with a fresh solution. To reproduce, create meteor-project and create .handlebars file on the server

cmather commented 11 years ago

Hey @warsamebashir, Sorry about the delay. I just tested this out. Looks like I made a mistake and need to check whether we're on the client or server and only compile if we're on the server. I thought this happened automatically, but I may have misunderstood the new build plugin api. In the mean time, to fix the issue, put your handlebars templates somewhere in a /server directory. That seems to work for me. I only saw your error when I put the handlebars files in the root directory (client and server).

cmather commented 11 years ago

I just tried a few quick things and wasn't immediately able to figure out how to only run the compile step on the server. If I spend a little more time on it I'm sure I could figure it out, but I'll have to come back to this. If you are able to dig into the plugin/compile-handlebars.js file and come up with a solution I would accept a pull request :-). Basically, we need to not run the compileStep for client files. Only server files. Hopefully the solution in my comment above works for now.

wbashir commented 11 years ago

Moving it to the /server directory fixes this and i will dig into that compile step check for the client and see if i can get anywhere on it. Thanks again for the workaround