Skip to content

Trim whitespaces before control structures and variablesΒ #6540

@Kapsonfire

Description

@Kapsonfire

Describe the problem

Fixes #6486

Describe the proposed solution

PHP Template Engine Twig solves it by adding a - to the curly braces

{{-variable }}
removes whitespaces before the variable/control structure

{{ variable -}}
removes whitespaces after the variable/control structure

combining both remove the whitespaces in front and end

Take a look at:
https://symfony.com/blog/better-white-space-control-in-twig-templates

Similiar solution for svelte could be nice as well

Alternatives considered

dont write whitespaces in your code - but makes the code ugly ;-)

Importance

nice to have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions