使用与 Node.js 的哈巴狗

var pug = require('pug');

// compile
var fn = pug.compile('string of pug', options);
var html = fn(locals);

// render
var html = pug.render('string of pug', merge(options, locals));

// renderFile
var html = pug.renderFile('filename.pug', merge(options, locals));

选项

  • filename 用于例外,在使用 includes 时需要
  • compileDebug 如果为 false,则不编译调试工具
  • 相当添加漂移缩进空格输出(默认为 false)