Skip to content

Instantly share code, notes, and snippets.

View AloisJanicek's full-sized avatar

Alois Janíček AloisJanicek

View GitHub Profile
@AloisJanicek
AloisJanicek / prettier-stylelint-auto.el
Last active February 10, 2022 15:35 — forked from ustun/eslint-auto.el
Run `prettier-stylelint --write` on css file opened in Emacs buffer when saving it
;;; runs `prettier-stylelint --write` on the current file after save
;;; alpha quality -- use at your own risk
(defun prettier-stylelint-fix-file-and-revert ()
"Prettify current file and apply fixes only in css-mode or scss-mode"
(interactive)
(when (or (eq major-mode 'css-mode) (eq major-mode 'scss-mode))
(message "prettier-stylelint fixing your file" (buffer-file-name)) ;;optional line, you can remove it
(shell-command (concat "prettier-stylelint --quiet --write " (buffer-file-name)))
(revert-buffer t t)))