lukejacksonn / oceanwind

Compiles tailwind shorthand into css at runtime. Succeeded by Twind.
https://twind.dev
264 stars 12 forks source link

Bug?: Cannot do multi-word colors (i.e., 'regal-blue') #27

Closed rschristian closed 3 years ago

rschristian commented 3 years ago

As the title states, users of Oceanwind cannot use multi-word colors though this is possible in Tailwind.

The reason for this can be found here. The logic assumes that the item at index 2 of the broken up string ("bg-regal-blue-500" -> "bg", "regal", "blue", "500") is the key in which to index the item at index 1 with. This works fine when the color is a single word, but fails when the color is a hyphenated word as the string split character is a hyphen.

This very well could be a intended sacrifice in functionality but it's something I ran across. Certainly easy enough to work around but I thought I would bring it up.

lukejacksonn commented 3 years ago

Humm, yeh.. this is partly an oversight but at the same time, a syntax that I would probably not want to encourage if I were creating tailwind as a language from scratch. In oceanwind the - delimiter has a very special meaning/purpose and the introduction of a variable with a - in it messes with that.

My suggestion would be to remove the - from regal-blue and make it regalblue or regalBlue but I will leave this issue open for visibility for now to help anyone else that might come across the same thing.

I'm not totally against covering it but I just think that this, as you say, is a completely avoidable edge case.

lukejacksonn commented 3 years ago

I don't think I'm going to cover this case any time soon so closing here.. feel free to open a PR if you get the time!