lukejacksonn / oceanwind

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

Append file path and line numbers to warnings #22

Closed lukejacksonn closed 3 years ago

lukejacksonn commented 3 years ago

Fixes #12

Warnings about missing or duplicate translations will now come with some stack trace info (thanks @JoviDeCroock!):

image

Clicking on the file path in dev tools will jump to the line in the file in the sources panel. Hopefully this makes tracking down mistakes a bit easier! I didn't really feel throwing was absolutely necessary here but I can see how that strictness might be reassuring in certain situations so it is now possible to opt into a strict mode that will error instead of warn:

image

This is possible by using a themed instance, with strict set to true:

themed({ strict: true })

Not sure if it will work everywhere 🤷‍♂️ if anyone has any better ideas then I'm all ears.

cc @bebraw

bebraw commented 3 years ago

This looks great. It would be awesome if you could make it optionally(?) to fail the entire build as a missing name implies a bug you should fix before deploying.

lukejacksonn commented 3 years ago

Yeh I can see value in that.. where would you expect such flags to live; in the theme?

bebraw commented 3 years ago

@lukejacksonn Yeah, theme feels like the perfect spot for customization.

lukejacksonn commented 3 years ago

Ok @bebraw it is now possible to do themed({ strict: true }) which will cause oceanwind to throw rather than warn about missing or duplicate translations.

bebraw commented 3 years ago

Great. 👍