koa-pug-global
a fork of koa-pug
, which add all locals props to locals._global
How to use
visit https://github.com/chrisyip/koa-pug for more, it is all the same
npm install koa-pug-global --save
const koa = const app = const Pug = const pug = viewPath: './views' debug: false pretty: false compileDebug: false locals: global_locals_for_all_pages basedir: 'path/for/pug/extends' helperPath: 'path/to/pug/helpers' random: 'path/to/lib/random.js' _: app: app // equals to pug.use(app) and app.use(pug.middleware) puglocalssomeKey = 'some value' app
//index.pugp #{title} === #{_global.title}