Using the Block and Content wth ExpressJS and express-handlebars
See original GitHub issueHi, I am wanting to use the block and content helpers to inject items from my partials to slots in other partials or the base layout file that includes html,head, body etc. I require it straight after handlebars-helpers
var exphbs = require('express-handlebars');
var hbsHelpers = require('handlebars-helpers');
in my main.hbs template I have the following near the closing body tag
{{{block "test"}}}
and on a partial page I have
{{#content "test" mode="append"}}
blah blah blah
{{/content}}
But when I run up the page it fails to load and I am presented with the following error
Error: Missing helper: "block"
at Object.<anonymous> (/Users/custa/github/Portfolio/portfolioapp/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/base.js:86:13)
at Object.eval (eval at createFunctionContext (/Users/custa/github/Portfolio/portfolioapp/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:221:23), <anonymous>:21:72)
at ret (/Users/custa/github/Portfolio/portfolioapp/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/runtime.js:159:30)
at ret (/Users/custa/github/Portfolio/portfolioapp/node_modules/express-handlebars/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:488:21)
at ExpressHandlebars._renderTemplate (/Users/custa/github/Portfolio/portfolioapp/node_modules/express-handlebars/lib/express-handlebars.js:247:12)
at ExpressHandlebars.<anonymous> (/Users/custa/github/Portfolio/portfolioapp/node_modules/express-handlebars/lib/express-handlebars.js:173:21)
at wrappedPromise.linkTransaction (/Users/custa/github/Portfolio/portfolioapp/node_modules/newrelic/lib/instrumentation/core/globals.js:147:23)
at wrappedPromise.wrapped [as __NR_wrapper] (/Users/custa/github/Portfolio/portfolioapp/node_modules/newrelic/lib/transaction/tracer/index.js:157:28)
at wrappedHandler (/Users/custa/github/Portfolio/portfolioapp/node_modules/newrelic/lib/instrumentation/core/globals.js:175:26)
Not sure what I am doing wrong, do I have to somehow register the helpers? Anybody got any thoughts?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6
Top Results From Across the Web
Handlebars With Node.js & Express - Tutorial For ... - YouTube
A beginner's guide to handlebars and how to use it with your node. js and express apps. Handlebars is one of the most...
Read more >Node.js + Express - Tutorial - Handlebars Templating Engine
Part of a complete node. js series, including the usage of Express. js and much more!This video introduces you to the Handlebars templating ......
Read more >Create Website With Handlebars Express - NodeJS - Geekstrick
In this tutorial, we will see how to Create a Website With Express Handlebars – NodeJS. With the handlebar-express, we can create a...
Read more >Guide to Handlebars: Templating Engine for Node/JavaScript
In this article, we are going to take a look at how to use the Handlebars template engine with Node.js and Express.
Read more >A Step By Step Guide To Using Handlebars With Your Node js ...
Let's Get Our Hands Dirty · npm init. After filling the necessary information, we need to install express of course by typing the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
nu i xyinya
Hello, show me your code.