https://github.com/russmatney/company-css-classes
Company-completion for classes in a css file
https://github.com/russmatney/company-css-classes
company css emacs
Last synced: 7 months ago
JSON representation
Company-completion for classes in a css file
- Host: GitHub
- URL: https://github.com/russmatney/company-css-classes
- Owner: russmatney
- License: mit
- Created: 2020-05-21T16:54:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-07T21:22:43.000Z (almost 5 years ago)
- Last Synced: 2025-01-23T00:13:26.432Z (9 months ago)
- Topics: company, css, emacs
- Language: Emacs Lisp
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: company-css-classes
Autocompletion for classnames in a css file.
Created to support tailwindCSS class autocompletion in clojurescript
hiccup-style components.Currently only supports completion in ~:class~ lists, as in:
#+BEGIN_SRC clojurescript
(defn my-component []
[:div
{:class ["text-"]}
"some content"])
#+END_SRCUtilizes a local cache to prevent extraneous parsing of the css file. The cache
can be cleared with ~M-x company-css-classes-clear-cache~.* Configuration
This lib parses css class-names from a css file specified via
`company-css-classes-filepath`. This can be set per project using
~.dir-locals.el~.#+begin_src elisp
;; /.dir-locals.el
((clojurec-mode
(company-css-classes-filepath . "./public/css/main-built.css"))
(clojurescript-mode
(company-css-classes-filepath . "./public/css/main-built.css")))
#+end_srcThe value is passed to `file-truename`, so relative and expandable filepaths should
work fine.* Roadmap
** [ ] Support completion following ~:div.text-~ syntax
This should be reasonable, and I believe company provides helpers to support
this.
** [ ] Support fetching the class definition for display in ~company-box~
* Installation
** Doom Emacs
#+BEGIN_SRC emacs-lisp
;; packages.el
(package! company-css-classes :recipe
(:host github :repo "russmatney/company-css-classes" :files ("*")));; config.el
(use-package! company-css-classes)(use-package! clojure-mode
:mode "\\.clj$"
:mode ("\\.cljs$" . clojurescript-mode)
:mode ("\\.cljc$" . clojurec-mode):config
(set-company-backend!
'clojurescript-mode
'(company-capf company-yasnippet company-flow company-css-classes-backend)))
(set-company-backend!
'clojurec-mode
'(company-capf company-yasnippet company-flow company-css-classes-backend)))
#+END_SRC