Oliver Angelil Oliver Angelil - 4 months ago 28
Jade Question

Compile .jade to .html in emacs

I'm using this mode in emacs for .jade files. The atom editor converts .jade files to .html when saving, I wonder if emacs can do the same thing?

Thanks,

Oliver

Answer

Sure, just put this in your .emacs:

(defun compile-jade ()
  (when (eq major-mode 'jade-mode)
    (shell-command (format "jade %s" buffer-file-name))))

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