Skip to content

moaxey/emacs-pug-mode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MIT MELPA MELPA Stable

pug-mode

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

Installation

pug-mode is available on MELPA.

M-x package-install RET pug-mode

Then a (require 'pug-mode) will do. No additional setup required!

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:

(add-hook 'after-save-hook 'pug-compile)

It requires pug-cli.

TODO

  • Define faces to improve customizability
  • Use multiline-font-lock
  • Optimize pug-indent-p and font-lock regexes
  • Refactor out vestigial slim-mode code

Contributions

I'm inexperienced at writing major modes for Emacs. Any contributions are welcome and appreciated!

About

Pug support for Emacs, based on slim-mode.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 60.6%
  • HTML 39.4%