opkzilla.blogg.se

How to use req.locals in pug template
How to use req.locals in pug template










I also didn't pass in process.env but it is also available. I didn't have to pass require statement to my pug locals. babelrc.js and populate paths by yourself.

how to use req.locals in pug template

You can either pass manually all those aliases and roots to the paths option inside require.resolve or you can write your own logic that reads configuration from. Const path = require ( 'path' ) const walk = require ( 'pug-walk' ) const runtime = require ( 'pug-runtime' ) const _ = require ( 'lodash' ) const pugPluginRequire = ( ) => ( `) this will be ignored and not manipulated as it doesn't match regexp.Īlso, if you are using some kind of module resolver, for instance babel-plugin-module-resolver that will not work out of the box.












How to use req.locals in pug template