vigetlabs / craft-viget-base

http://code.viget.com/craft-viget-base/
7 stars 3 forks source link

[Improvement] Add a clearer error message regarding Tailwind JSON #77

Open joshuapease opened 8 months ago

joshuapease commented 8 months ago

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:

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.