devsite/node_modules/pug/register.js

21 lines
465 B
JavaScript
Raw Normal View History

2024-07-08 01:49:38 +00:00
var pug = require('./');
var resolvedPug = JSON.stringify(require.resolve('./'));
function compileTemplate(module, filename) {
var template = pug.compileFileClient(filename, {
inlineRuntimeFunctions: false,
});
var body =
'var pug = require(' +
resolvedPug +
').runtime;\n\n' +
'module.exports = ' +
template +
';';
module._compile(body, filename);
}
if (require.extensions) {
require.extensions['.pug'] = compileTemplate;
}