Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Add locals object in pug render function #182

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/compilers/pug.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ var ensureRequire = require('../ensure-require.js')
module.exports = function (raw, cb, compiler) {
ensureRequire('pug', 'pug')
var pug = require('pug')
var locals
var options = compiler.options.pug || {}

locals = options.data || {}

try {
var html = pug.compile(raw, compiler.options.pug || {})()
var html = pug.compile(raw, options)(locals)
} catch (err) {
return cb(err)
}
Expand Down