Replies: 1 comment 1 reply
-
|
This teleportation id probably impossible to implement in the current architecture of Twig though. Side note, modals based on |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I primarily submitted an idea on the asset mapper project, but now that I unzoomed my idea a bit, I would like to propose here a new version; note that everything about implementation, names, etc.. Are not the point, I'm sure of anything!
Let's think about a stack portal in twig syntax. In my use cases, it can be useful for CSS, modals, and scripts.
Let's set up an example :
At this point, we don't care about what is included; What I see is that in my layout, I have to know which blocks will be used in this very page (in this simple case: title and blogpost), and to accordingly import the CSS files.
So I may want to defer the CSS loading in my blocks? ..But as a
<link>tag is not meant to exist in the body, I would like to use a{% block styles %}syntax. ..But to achieve, I need to extends my foo template. ..And if I succeed at it, if I have 10 blog posts, I will include 10 times the template, and so import 10 times the CSS!So, let's welcome a new {% stack %} syntax:
Used like this, stack has 2 superpowers:
With both, you can create great components without having to think about how to connect them on your exterior twig files; you just write your component, and when the page is generated, everything will work out of the box.
<body>, as a direct & last children.<style>duplication, but when working with modals, it appears clearly that it should be a twig new feature, that you will be able to plug with asset-mapper/importmap/twig components/live components/web components/stimulus/early hints/whatever.I can imagine that if no stacking out directive is found, the stacking in is warped out and a warning is emitted, but I can't think of all the implementation details.
Thank you in advance for your time for reading me, and sorry in advance if this is trivial or non-sense.
Beta Was this translation helpful? Give feedback.
All reactions