Hapi Locals
A Hapi plugin to add local variables and functions to all templates rendered.
Goal:
Add server method "locals" to add global variables and functions for all templates. Just like app.locals in expressjs.
How to use
// register pluginplugins = ; plugins; // or, with hoek merge optionsplugins; server; // set local variable or functionservermethods; servermethods; servermethods;
Using in jade template
title #{siteTitle} link(rel='stylesheet', href='/public/css/main.css?#{cacheVer}') p!= sayHi("Tony")
Plugin Options
hapi-locals use hoek.merge to merge the context, you can set the merge parameters in options
isNullOverride
default to true
isMergeArrays
default to true