The pug templating engine is designed to be easily extensible, as well as having powerful core functionality. It was recently re-written to be more modular and structured. This talk discusses how a compiler is built out of a series of independent stages.