Skip to content

Code Style: Strange behavior with svg function #91

@rellafella

Description

@rellafella

When using Craft CMS' svg function there is some slightly odd behavior, not sure if it's intentional or not.

Retains it's structure on a single line ✅

{{ svg("path/to/file.svg") }}

Retains it's structure on a single line ✅

{{ svg("path/to/file.svg")|attr }}

Suddenly breaks onto many lines ⚠️

{{ 
    svg("path/to/file.svg")|attr({
        class: "w-6 h-6",
    }) 
}}

What I would expect

The object follows the value of the twigAlwaysBreakObjects option and everything else stays as it was.

{{ svg("path/to/file.svg")|attr({
    class: "w-6 h-6",
}) }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR WelcomedSomething that I don't want to work on, but will reconsider if people send well written PR.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions