/css-in-js.el

An Emacs minor mode used for CSS-in-JS

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

emacs 29 and treesit

emacs 29 and newer includes native support for treesit, meaning a lot of features of this minor mode are no longer needed. users of emacs 29 are encouraged to try the CSS-in-JS treesit grammar and emacs minor mode for emacs 29. users of emacs 28, read on!

css-in-js.el

Emacs minor mode to enable a better development experience for (some) CSS-in-JS. If your webapp uses:

then this might be of use to you.

above: typescript-mode, styled-components, and company-mode with company-quickhelp-mode

Installation

  1. Dependencies: make sure you have mmm-mode and scss-mode installed already. They're both available in MELPA and probably elsewhere too.
  2. Install: download this package and place it inside a directory on your load-path
  3. Require: (require 'css-in-js)
  4. Enable: (css-in-js-mode t)

Configuration

useful variables are members of the css-in-js-mode group and can be viewed and modified with the command M-x customize-group [RET] css-in-js-mode [RET].

css-in-js-mode also uses css-indent-offset during indentation so be sure to set that to an acceptable value. You might also be interested in playing around with mmm-submode-decoration-sublevel.

Bugs?

plenty. indentation is kinda janky right now, there are probably some enhancements to be made around LSP, and it doesn't support a whole bunch of popular css-in-js libraries. I've also only done minimal testing with web-mode and js-mode. PRs welcome for any and all bugs and feature-requests!