-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix node.js support #90
Conversation
…ation to prepublish, rather than preinstall to remove the jison dependency for normal users
Please just publish this to npm yourself! You can always add wycats, and even remove yourself, later on, thanks to the magic of npm. |
We've got a package up now. Thanks! |
To prevent others from flailing embarrassingly long (like I did) to get this going:
|
Since trentm comment was pretty helpful, here is mine. Got node to use precompiled templates by simply including them using requires. For example: global.Handlebars = require('handlebars'); var small_template_data = {title: "My New Post", body: "This is my first post!................................"}; var small_template = Handlebars.templates['handlebars_small_template.html']; canvas = Handlebars.templates'handlebars_small_template.html'; rendered_text += canvas; console.log(rendered_text); |
I'm confused, was this pull request integrated with handlebars.js, ie, can we run handlebar tempaltes on the server under node.js? Is there a full server side example anywhere, I've been searching and haven't really found one. Unless that is trentm's post above is the answer. I'm kind of new to node.js and want to be able to use Handlebars under it on the server. |
I have updated my comment above, looks like the bottom of the example was missing. |
For anyone else who found this page like I did and was still confused as to how to get server-side templates working without pre-compiling them, I've build upon trentm's example and stuck my code here. Hope this helps someone! |
This addresses #53
The node.js support in handlebars today doesn't seem to work (unless I'm missing something). Primarily the issue is that it's not using relative paths when requiring. Additionally I added a package.json to allow handlebars to be published as an NPM module. If you guys accept this pull request, then publishing the npm package is simply a matter of:
(http://howtonode.org/introduction-to-npm)
Thanks!
Joshua