_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

Support negative modifiers on class names (as in TailwindCSS)

Open rtgoodwin opened this issue 4 years ago • 2 comments

Currently, trying to pass a class name with - appended will cause an error. Per discussion on Discord this should be supported.

Example that will fail:

on change add .left-0 .-top-0 

For now using the excellent example provided of modifying margin-top.

rtgoodwin avatar Oct 29 '21 13:10 rtgoodwin

After watching the video on TW CSS 3.0 and the JIT CDN, I think it's probably best to call out the other JIT-style class syntax examples:

  • bg-gray-100/50 (rgba)
  • w-[50px] (arbitrary values)
  • md:dark:hover:bg-blue-500 (stacked responsive modifiers)

Not sure how many work now/don't, but figured best to snag 'em all at once :)

rtgoodwin avatar Oct 29 '21 14:10 rtgoodwin

I think the most sensible solution is to support escaping special characters in classnames, since this is the same way Tailwind has to do it so browsers understand the syntax correctly:

.w-\[50px\] { }
.p-0\.5 { }
.dark\:hover\:bg-gray-100 { }

julianwachholz avatar Apr 03 '22 11:04 julianwachholz