Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Made with Doom Emacs Release tag MIT MELPA MELPA Stable Build Status


pug-mode offers Emacs support for Pug. Unlike jade-mode, it is based off of slim-mode.


pug-mode is available on MELPA.

M-x package-install RET pug-mode

(require 'pug-mode)

Why not use jade-mode?

I created pug-mode because jade-mode (based on sws-mode) is incomplete in ways that are inconvenient to me. For instance, it has poor/no fontification of plain-text, filter blocks, or mixin definitions/invokations; its indentation strategies seemed too aggressive and the source was too difficult to grok quickly to address these issues.

In contrast, it took me 10 minutes to grok slim-mode's source and another 10 to adapt it to Pug in—what I think—is a better result. Most of the code is lifted right out of slim-mode, so much of the credit belongs to its original developers!

Auto-compiling pug files

This plugin introduces a pug-compile function. You can call it directly (e.g. M-x pug-compile) or have it done automatically for .pug files:

(defun pug-compile-saved-file()
  (when (and (stringp buffer-file-name)
             (string-match "\\.pug\\'" buffer-file-name))
(add-hook 'after-save-hook 'pug-compile-saved-file)

It requires pug-cli.


I am no expert at writing major modes for Emacs and welcome contributions of any kind. Be they pull requests, bug reports or elisp tips!