-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding importmap_polyfill
#18537
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
Adding importmap_polyfill
#18537
Conversation
Please doublecheck - the info is taken from symfony/symfony#50912 (comment)
|
||
.. code-block:: html | ||
.. code-block:: yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should have the configuration block for all supported formats, like elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't know the other formats' syntax :-( But starting with YAML is certainly better than nothing...
@@ -289,17 +289,25 @@ Preloading and Initializing "app.js" | |||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||
|
|||
In addition to the importmap, the ``{{ importmap() }}`` Twig function also renders | |||
an `ES module shim`_ and a few other things, like a set of "preloads": | |||
an `ES module shim`_. You can disable this in your ``config/packages/asset_mapper.yaml`` | |||
configuration file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably also document the fact that we can customize the source of the shim, not just disabling it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it as comment inside the code block. Not very elegant - I have to admit ;-)
<link rel="modulepreload" href="/assets/app-4e986c1a2318dd050b1d47db8d856278.js"> | ||
<link rel="modulepreload" href="/assets/duck-1b7a64b3b3d31219c262cf72521a5267.js"> | ||
|
||
This is a performance optimization and you can learn more about below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep this in the same paragraph than before instead of moving the code block in the middle of the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure what you mean. And (more important) I can't quite imagine what it will finally look like, just by looking at GitHub's diff.
So maybe merge it as-is, then you move it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When moving the existing code block, you split the existing paragraph in 2, putting the code block in the middle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you want me to move the <link rel="modulepreload"...
code block down after "learn more about below in Performance: Add Preloading."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a different idea:
A) Add all of this to a new section under Configuration Options
instead of here - https://github.com/symfony/symfony-docs/blob/91be2224cb6e6d62d643a546618d054a5e80dfe0/frontend/asset_mapper.rst#configuration-options
B) Leave this section unchanged, except change the top to point to that config section
In addition to the importmap, the ``{{ importmap() }}`` Twig function also renders
an `ES module shim`_ (see the :ref:`config-importmap-polyfill <polyfill config>` and
a few other things, like a set of "preloads":
(below, above the new section, you'd add .. _config-importmap-polyfill:
so that the above :ref:
works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I opened a new PR: #18554
As requested at symfony#18537 (comment)
…auer) This PR was merged into the 6. 8000 3 branch. Discussion ---------- Adding `importmap_polyfill` (second attempt) As requested at #18537 (comment) Closes #18537 Commits ------- f95a507 Adding `importmap_polyfill` (second attempt)
Closing as fixed in #18554. Thank you all for the contribution and the reviews. |
Page: https://symfony.com/doc/current/frontend/asset_mapper.html
Please doublecheck the YAML syntax - the info is taken from symfony/symfony#50912 (comment)
Closes: symfony/symfony#50912