-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
Whitespace control when using twig components? #2228
Comments
Hi Nicolas,
What do you mean about "noise"? is it blocking Turbo or equivalent? or is it "purely visual" ? When I look at the examples they have spaces around the first element, and it seems to be working well. IIUC Turbo will find the first
For the moment no, it's not possible to control whitespaces for the component HTML syntax.
It can yes, I think there's surely a use case where it would be desirable to control blanks, to avoid the following problem: About the implementation, maybe |
Most of the time it doesn't matter, sometimes it does :) eg the |
Ah, yeah, didn't think about I also thought about globally configure this behaviour, like Some folks in sveltejs/svelte#3080 suggested about a |
|
This should be dealt with in Twig i think. But you can already enforce it inside your component i suppose ? {# index.html.twig #}
<twig:Acme:Alert>
Hahaa
</twig:Acme:Alert>
{# Acme:Alert.html.twig #}
<div{{ attributes }}>
{%- block content '' -%}
</div> Should render In general i'm seeing TwigComponent as "blocks" more than "elements", and so internal whitespace should not be something to consider too much, but i'm open to any change if that is something people want/need. Just: no new exotic syntax for now please ^^ |
span { display: inline; } |
I'm using a twig component like:
But the whitespace around the div is noise (but still nice for formatting).
Is there a way to ask twig to remove it?
Using the non-HTML-like syntax, I can by using
-%}
/{%-
, but what about the html-like syntax?Is there some twig:trim="before/after/true/both" that I could use for that? Or that could be added if that looks like a good idea?
The text was updated successfully, but these errors were encountered: