-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Bug that prompted this ticket
Overview:
Craft projects can optionally import a JSON encoded version of a project's TW config.
Most often, we use these TW config values in Twig:
- Use Tailwind's screens key/value pairs in a component so we can use values like
sm
,md
, etc to get a configured media query. MW's image macro uses it so that srcset/sizes code is kept in sync with Tailwind's breakpoints (it also saves writing out full media queries). - Automatically displaying config values like colors & sizes in our parts kit (see MW again).
Decision points
We need to decide if we want a hard error on every page or some other kind of warning.
I think an exception is still necessary, but a clearer error message that explains what the file is for and why it's not there would be a useful improvement.
If template code depends on a JSON file being there, it probably makes sense to know right away rather than have unexpected behavior, or exceptions on only a handful of pages that might make calls to TW.
One frustrating thing about the current implementation is that it always looks for a JSON file and throws even if you aren't using it in your config.
We may want to make this an opt-in feature. However, that would probably be a breaking change.