My experience with front-end developers not liking twig is because the dynamic data is wrapped in an object they have to debug to get the data. I'm looking at Drupal as the worst offender.
You can create components by using include templates. By using a namespace you can identify those templates as components better, $loader->addPath('./templates/components', 'components');.
But the way this package adds their templates made me look into how they did it. <twig:Alert message="hello!" user="{{ user.id }}" /> look more htmly than {{ component('Alert', {message: "hello", user: user.id}) }}.
The side note i have is that the twig: prefix is to generic.
So I started to look through the code and found the class that makes this work, github.com/symfony/ux-twig-compone...
It looks like a lot of work, but I didn't know you could do that. It is great I know this now, not sure if I ever going to need it.
On the topic of components. It has been popularized by front-end frameworks, but in css you had build tools like sass, less, and others that used the component idea already.
It is just an easy way to break down a UI.
You can use it from UX and design people to software developers, to create a consistent vocabulary.
I love to see how more back-end solutions are embracing the component idea. Like the Drupal single directory component, and the package you presented in your article.
My experience with front-end developers not liking twig is because the dynamic data is wrapped in an object they have to debug to get the data. I'm looking at Drupal as the worst offender.
You can create components by using
includetemplates. By using a namespace you can identify those templates as components better,$loader->addPath('./templates/components', 'components');.But the way this package adds their templates made me look into how they did it.
<twig:Alert message="hello!" user="{{ user.id }}" />look more htmly than{{ component('Alert', {message: "hello", user: user.id}) }}.The side note i have is that the
twig:prefix is to generic.So I started to look through the code and found the class that makes this work, github.com/symfony/ux-twig-compone...
It looks like a lot of work, but I didn't know you could do that. It is great I know this now, not sure if I ever going to need it.
On the topic of components. It has been popularized by front-end frameworks, but in css you had build tools like sass, less, and others that used the component idea already.
It is just an easy way to break down a UI.
You can use it from UX and design people to software developers, to create a consistent vocabulary.
I love to see how more back-end solutions are embracing the component idea. Like the Drupal single directory component, and the package you presented in your article.
Thank you for writing!
Hey, thanks for your feedback! I appreciate this deep answer! I didn't know about the Drupal single directory component thanks for sharing!