11 releases

0.2.0 Feb 20, 2023
0.1.10 Apr 19, 2019
0.1.9 Mar 26, 2019
0.1.8 Dec 17, 2018
0.1.7 Oct 4, 2018

#576 in Template engine

42 downloads per month

MIT license

17KB
456 lines

pug-rs

crates.io

A port of pug to Rust.

This is a maintained fork of the original code by github.com/aep.

CLI usage

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

Using with 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')]
      },

Dependencies

~2–2.9MB
~58K SLoC