11 个版本

0.2.0 2023年2月20日
0.1.10 2019年4月19日
0.1.9 2019年3月26日
0.1.8 2018年12月17日
0.1.7 2018年10月4日

#514模板引擎

每月下载 42

MIT 许可证

17KB
456

pug-rs

crates.io

pug 的 Rust 版本。

这是 github.com/aep 的原始代码 的维护分支。

CLI 使用

$ cargo install pug
$ pug < thing.pug > thing.html

与 webpack 一起使用

pug_loader.js

const spawnSync = require('child_process').spawnSync;
module.exports = function(source) {
  var proc = spawnSync("pug", {
    input: source
  });
  if (proc.status != 0) {
    throw proc.error;
  }
  return proc.stdout.toString();
}

webpack.config.js

  module: {
    rules: [
      {
        test: /\.pug$/,
        use: [require.resolve('./pug_loader.js')]
      },

依赖项

~2.2–3MB
~60K SLoC