hz-zhhq-web/node_modules/vue-jest/lib/compilers/pug-compiler.js

19 lines
471 B
JavaScript

var ensureRequire = require('../ensure-require.js')
const throwError = require('../throw-error')
module.exports = function (templatePart, config) {
const options = (config && config['pug']) || {}
if (templatePart.filename) {
options.filename = templatePart.filename
}
var html
ensureRequire('pug', 'pug')
var jade = require('pug')
try {
html = jade.compile(templatePart.content, options)()
} catch (err) {
throwError(err)
}
return html
}