Skip to content

Commit dc4d524

Browse files
authored
Merge pull request merrickluo#33 from aburtsev/docs-twinmacro-setup
[docs] twin.macro setup
2 parents 629ece1 + 065bb65 commit dc4d524

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.org

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,19 @@ If you want to use lsp-tailwindcss in some other file types, like =erb=, you mig
8585
#+end_src
8686

8787
This is a requirement for lsp-mode, not just for =lsp-tailwindcss=, see https://github.com/emacs-lsp/lsp-mode/blob/563233fe72de6f32ffc6a1b3db0ec7f49c12cb50/lsp-mode.el#L694 .
88+
89+
** How to set up [[https://github.com/ben-rogerson/twin.macro][twin.macro]]?
90+
91+
twin.macro can be integrated using =lsp-tailwindcss-experimental-class-regex= variable (which is alias to =tailwindCSS.experimental.classRegex= . see the reference to [[https://github.com/ben-rogerson/twin.macro/discussions/227][discussion]])
92+
93+
#+begin_src emacs-lisp
94+
(use-package! lsp-tailwindcss :init (setq! lsp-tailwindcss-experimental-class-regex ["tw([^]*)" "tw=\"([^\"]*)" "tw={\"([^\"}]*)" "tw\\.\\w+([^]*)" "tw\\(.*?\\)([^]*)"]))
95+
#+end_src
96+
97+
98+
Take a note that it can lead to [[https://emacs-lsp.github.io/lsp-mode/page/faq/#i-have-multiple-language-servers-registered-for-language-foo-which-one-will-be-used-when-opening-a-project][the conflict of lsp-servers priorities]] (i.e. some of the servers will not start). To fix this you need to use =lsp-tailwindcss-add-on-mode= too.
99+
100+
Set up with add-on mode:
101+
#+begin_src emacs-lisp
102+
(use-package! lsp-tailwindcss :init (setq! lsp-tailwindcss-experimental-class-regex ["tw`([^`]*)" "tw=\"([^\"]*)" "tw={\"([^\"}]*)" "tw\\.\\w+`([^`]*)" "tw\\(.*?\\)`([^`]*)"]) (setq! lsp-tailwindcss-add-on-mode t))
103+
#+end_src

0 commit comments

Comments
 (0)