lukejacksonn / oceanwind

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

Bug?: "default" is not a special key that means "no-modifier" in Oceanwind #26

Closed rschristian closed 3 years ago

rschristian commented 3 years ago

It seems that there is a missing translation for a plain "shadow". While items like "shadow-sm" and "shadow-md" work without issue, "shadow" raises that warning listed in the title and won't apply the expected amount of shadow.

I originally thought this was limited to just the "shadow" class but I've come to notice that default is not a special key as it is with Tailwind. While with Tailwind I could do .shadow, with Oceanwind I need to do .shadow-default. Same goes for my colors. For example, the nested object syntax from Tailwind's documentation would not work here. The user would .text-indigo-default with Oceanwind.

I'm not sure if this is a bug or a feature that hasn't yet been implemented.

lukejacksonn commented 3 years ago

Hey 👋 thanks for taking the time to create this issue. When I started the project I didn't handle default values because it meant duplicating a lot of rules. But I'm happy to support them now.

If you would like to experiment with implementing these cases yourself then create a test for them in /test/module.js something like this:

shadow: theme.boxShadow['default']

Then run yarn start, a server should start and it will be serving an index.html which runs the tests. In the console you will see one test failing. You can then go into /translate.js and fix it by adding an implementation for the case.

Something like this:

case 'shadow':
  out['box-shadow']: theme.boxShadow['default'];
  break;

That should make the failing test pass.

I will try get around to fixing these cases asap if you don't get around to it but hopefully this will help you fix your own problem until then. Let me know if you have any issues, more than happy to help and review PRs!

rschristian commented 3 years ago

Thanks for the quick response.

I'll definitely give it a shot a bit later, see if I can get a PR together or something.

lukejacksonn commented 3 years ago

Hey Christian 👋 so shadow has been fixed by #32. I'm going to try and find/fix some more though. If you find any directives missing (other than the ones you already mentioned) then noting them down here would be very useful 🙏

rschristian commented 3 years ago

Ah, great, thanks. Sorry, got busy with work + life any never was able to get some time to work on this myself.

I can definitely let you know if I find anymore though. Thanks for your work on the lib, I'm really enjoying it so far.

lukejacksonn commented 3 years ago

That's ok man, creating an issue was already contribution enough! I'm happy you are finding the library useful 🥇 please let me know of any other issue you are having. I plan to start on work that will cover changes in Tailwind V2 soon!