-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathontop-webdev.el
102 lines (84 loc) · 2.86 KB
/
ontop-webdev.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
;;; ontop-webdev.el --- HTML and CSS configuration -*- lexical-binding: t; -*-
;; This file is part of Emacs ONTOP
;; https://github.com/monkeyjunglejuice/emacs.ontop
;;; Commentary:
;; You can also use this file/configuration independently from Emacs ONTOP
;; Load it from anywhere via `(load-file "/path/to/ontop-webdev.el")'.
;;; Code:
;; ____________________________________________________________________________
;;; USE-PACKAGE
;; <https://github.com/jwiegley/use-package>
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package nil))
(eval-when-compile
(require 'use-package))
;; ____________________________________________________________________________
;;; WEB-MODE
;; <https://web-mode.org>
(use-package web-mode
:ensure t
:defer t
:custom
(web-mode-attr-indent-offset 2)
(web-mode-attr-value-indent-offset 2)
(web-mode-code-indent-offset 2)
(web-mode-css-indent-offset 2)
(web-mode-markup-indent-offset 2)
(web-mode-enable-auto-expanding t)
(web-mode-enable-block-face t)
;; TODO: styling required for web-mode-current-element-highlight-face
(web-mode-enable-current-element-highlight t)
':mode
;; Associate Web-mode with the following file types?
'("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . web-mode)
'("\\.css\\'" . web-mode)
:bind
(:map web-mode-map
("C-M-f" . web-mode-forward-sexp)
("C-M-b" . web-mode-backward-sexp)))
;; ____________________________________________________________________________
;;; HTML-MODE
;; <https://www.gnu.org/software/emacs/manual/html_mono/emacs.html#HTML-Mode>
(use-package sgml-mode
:ensure nil
:defer t)
;; ____________________________________________________________________________
;;; CSS-MODE
(use-package css-mode
:ensure nil
:defer t
:custom
(css-indent-offset 2))
;; ____________________________________________________________________________
;;; JS-MODE
(use-package js
:ensure nil
:defer t)
;; ____________________________________________________________________________
;;; SYNTAX-CHECKER / LINTER
;; <https://www.gnu.org/software/emacs/manual/html_mono/flymake.html>
(use-package flymake
:ensure nil
;; Syntax checkers don't work with web-mode, but the other modes
;; Install the linter via: `npm install -g stylelint stylelint-config-standard'
:hook
((html-mode css-mode js-mode) . flymake-mode))
;; <https://github.com/purcell/flymake-css>
;; Install the linter via `npm install -g csslint'
(use-package flymake-css
:ensure t
:defer t
:custom
(flymake-css-lint-command "csslint")
:hook
(css-mode . flymake-css-load))
;; <https://github.com/orzechowskid/flymake-eslint>
(use-package flymake-eslint
:ensure t
:defer t
:hook
(js-mode . flymake-eslint-enable))
;; ____________________________________________________________________________
(provide 'ontop-webdev)
;;; ontop-webdev.el ends here