Skip to content

Suggestions for template variables using the |default filter #30

Description

@wgordon17

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 😞

Activity

  1. boxed commented on Jun 10, 2023

    @boxed
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions