CSS github.com

Enjoy writing CSS in your JS? Try writing JS in your CSS! 😏  ↦

First off, everything happens in your CSS file. You can layer this into your websites as you see fit. You can use this to layer on just a little bit more functionality in your CSS here and there or construct an entire page. It’s up to you!

If you think this sounds crazy… just wait until you have a look at it:

.item {
  cursor: pointer;
  --js:(
    function toggle() {
      this.classList.toggle('active');
    }
    this.addEventListener('click', toggle );
  );
}

Play around with CJSS on Codepen, but that’s all I’d advise you to do with it (as would the author).


Discussion

Sign in or Join to comment or subscribe

0:00 / 0:00