lukejacksonn / oceanwind

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

Provide more context for "No translation for" in development mode #12

Closed bebraw closed 3 years ago

bebraw commented 3 years ago

Maybe there should be a flag or so to show a stack trace for these cases as they can be a little tricky to debug otherwise.

lukejacksonn commented 3 years ago

It would be nice to know where the bad directive was being used for sure.. I even considered making aset of rules that it would default to as well. Something like:

border: 5px solid red;
transform: scale(2);

So that the affected element was apparent visually in the UI itself. This doesn't necessarily help find the error though, just makes it unmissable. Until now I just do a search of my project files for the missing directive 😅

bebraw commented 3 years ago

I wonder if it would make most sense to throw an error here. That would crash the build but at least you would get a stack trace then. 😄

Maybe the thing to do would be to have some not too obtrusive default behavior and let users define an error handler (i.e. onError: (???) => void. Then, if you want, you could throw there or do something else.