Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions for template variables using the |default filter #30

Open
wgordon17 opened this issue Jun 10, 2023 · 1 comment
Open

Suggestions for template variables using the |default filter #30

wgordon17 opened this issue Jun 10, 2023 · 1 comment

Comments

@wgordon17
Copy link

I have a whole bunch of templates that rely on the "empty resolves to false" behavior. Specifically setting some HTML class attribute defaults

class="{{height|default:'h-5'}} {{width|default:'w-5'}} {{color|default:'text-blue-500'}}"

Just wondering if you have any suggestions on

  • How to do this "properly" so that it doesn't run afoul of your package
  • Configuring your package so it doesn't yell at me
  • Other ideas? ¯\_(ツ)_/¯

I like the other protections from gotchas that fastdev provides, just this one little nuance that has me disabling it for now 😞

@boxed
Copy link
Owner

boxed commented Jun 10, 2023

I suggest always send those variables to the template. Presumably as None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants