
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
nunjucks-hapi
Advanced tools
A simple wrapper to let you use Nunjucks as a Hapi templating engine.
The following example will let you use Nunjucks templates, including template inheritance, inside Hapi. This assumes:
var Hapi = require('hapi')
var Path = require('path')
var NunjucksHapi = require('nunjucks-hapi')
var Vision = require('vision')
var server = new Hapi.Server()
server.connection({port:5000,host:'localhost'})
// set up templates
server.register(Vision, function(err) {
server.views({
engines: {
html: NunjucksHapi
},
path: Path.join(__dirname, 'views')
})
// Add a route
server.route({
method: 'GET',
path: '/test',
handler: function (request, reply) {
reply.view('mytemplate',{
'myvariable': 'myvalue'
})
}
})
// start server
server.start()
})
If you want to go beyond the default configuration of Nunjucks, you need to configure an environment. Once that's done, you can do anything to the environment, like add filters or custom tags via extensions. This works just like the Nunjucks documentation says it does, with the exception that the path to templates is now required.
The example is otherwise the same as the above
var NunjucksHapi = require('nunjucks-hapi');
// set a common view path
var viewPath = Path.join(__dirname, 'views')
var env = NunjucksHapi.configure(viewPath)
// do anything you want to the env here
env.addFilter('somefilter', function(str, count) {
// return some string
})
// set up templates with the same view path
server.register(Vision, function(err) {
server.views({
engines: {
html: NunjucksHapi
},
path: viewPath
})
server.start()
})
FAQs
A simple wrapper to use Nunjucks templates in Hapi
We found that nunjucks-hapi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.