-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
[TwigComponent] Allow :
as value separator in {% props %}
tag
#2488
base: 2.x
Are you sure you want to change the base?
Conversation
I don't like this proposal 😐 First, I think that in Twig the natural way of initializing variables and arguments is with the {% set foo = '...' %}
{% macro input(name, value, type = "text", size = 20) %}
{% endmacro %} The Second, the proposed Set nested props: {% props
foo = '...',
bar:foo = '...',
%} Define the prop type and enforce data type validation: {% props
foo: int = 3,
bar: string,
baz: array = [],
%} |
I think I need to write more on my PR comments, to contextualize thing and limit chances of missunderstandings :) This PR only bring on props tag Twig features... Things are moving fast on Twig... 99% thanks to the impressive energy/time Fabien has dedicated on Twig these last months.. Using Rest assured I did not remove a single thing currently possible here... only added compatibility with the Twig evolution. My goal here is to avoid frustrations for users... Using something in Twig and then experiencing errors or problems while using the same features with Live/Twig components is a "red line" I'd like to never see. https://twig.symfony.com/doc/3.x/coding_standards.html https://twig.symfony.com/doc/3.x/templates.html#named-arguments Also... please believe me i'd like to do other things with my time... (the amount of feature I could work on without spending 90% of my time doing support or debug would be impressive.... but I deeply think UX still needs this attention for now) Please poke me if i there is something I can precise more or ... or anything in fact :) |
Simon, I agree with all you said, but I still think there's a misunderstanding about this: You say that Twig now uses But that's what I said: Twig uses For example, Twig uses this: {% set foo = '...' %}
{% macro input(name, value, type = "text", size = 20) %}
{% endmacro %} But not this: {% set foo: '...' %}
{% macro input(name, value, type: "text", size: 20) %}
{% endmacro %} |
I tend to agree with you @javiereguiluz. |
Ok I get it better. As I see it, the most similar Twig tag is... the new https://twig.symfony.com/doc/3.x/tags/types.html {% types {
is_correct: 'boolean',
score: 'number',
} %} Looks familiar no? 😅 Again, I have no opinion here, I just want to be sure we are fully compatible with Twig. And let's forget I said anything about switching to the new syntax :) |
Also... and I really know it's not an argument per se.. but if we can ease developers DX, i'm always ok 👼 static stimulus = {
url: String,
interval: Number,
params: Object
}
interface VueJs {
title: string
author: string
year: number
} .css {
foo: 'bar',
bar: 123,
} |
I understand what you say about the props tag. But this is why I also think it was a mistake to use "=" already. The Or else a But this is very interesting, and once more everyone has its own understanding / vision of features related to Twig Components... which is nice because everyone interprets and reads them in its own way :) |
Simon, in your previous comment (#2488 (comment)) you are agreeing with me. These examples that you shared:
They are the second use-case that I shared earlier about the possible use of In my opinion, all this conversation reduces to this:
That's why I think this proposal is "wrong" because it tries to use |
Previous syntax
New syntax
Both are now valid!
but if we follow Twig conventions, we should switch to the new one in the documentation, etc..removed :)