-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Allow custom script/link tag attributes to be passed #10
Comments
It could be nice to be able to integrate |
💯 with Kévin! |
Having an option for generating absolute urls would be useful as well. In my case I need these for wkhtmltopdf rendering. |
A way to just get a list of files would be nice - For Content-Security-Policy 3, nonce and strict-dynamic one would also need custom script tags (to add another use case) - a generic way of letting anybody do what they want would be most flexible, because I don't think there is a finite set of use cases you can completely cover when you only offer to specifically generate the script tags (or, for example, specifically add it to WebLink) via the bundle. |
Ah I just saw that those already exist - Maybe it is also worth mentioning |
yeah, the 2 functions returning the list of files should be documented, as they allow full flexibility. |
Additional use case for parameters: the media tag (e.g. |
@alexismarquis you should do this by either setting the public path to an absolute URL in |
@weaverryan yeah I thought about that, but this approach would make all asset urls to have an absolute url, which is not something I need for the other templates. Anyway, using the |
@weaverryan Any news on this feature? Since having the possibility to add integrity hashes to your assets (which is great), it's even more complicated to add custom attributes than before. For example, if I'd wanted to add
But how do you add the integrity hashes now? Is it even possible? As far as I understand, that's only possible using either |
As @iquito stated before, it would be nice if we could pass a Had to do a hack to insert the attribute via |
@weaverryan do you have an ETA for this ? do you need some help ? |
I think it would be interesting to load JS assets at the very end of the rendering of a page with Webpack Encore. It is well explained in this interesting video. But the encore_entry_script_tags does not provide such a feature if I am right. it only renders the script HTML element with src attribute. What if the encore_entry_script_tags could render a script element in which we would find:
So that, like explained in the video, all the JS assets would be parsed after the page rendering. Or am I missing an already implemented functionnality of Webpack Encore that I don't already know? Thanks for your feedbacks |
It maybe raise a dispatch before render some tags, this is more flexible and inline with the symfony style. Or some other hook's mechanis to change the attributes array //Symfony\WebpackEncoreBundle\Asset\TagRenderer.php
if (isset($integrityHashes[$filename])) {
$attributes['integrity'] = $integrityHashes[$filename];
}
<---- HERE
$scriptTags[] = sprintf(
'<script %s></script>',
$this->convertArrayToAttributes($attributes)
); For the case of CSP and nonce the nonce must be generated for each request, so with this feature |
any update on this feature? |
It seems there are multiple issues discussed here and it might make sense to discuss (and implement) each one separately, hopefully this will help things move forward:
I would love to have at least point 1.a implemented (allow custom attributes). This will unlock plenty of features right now ( |
There are a few legit use-cases for wanting to use the
encore_entry_script_tags()
functions, but pass a custom attribute:integrity
attributepreload
,async
, etcAnother attribute, in theory, would be adding
data-
attribute on your script tag. But, that doesn't make sense withencore_entry_script_tags()
, because this could render multiple script tags.I think the main use-cases then are the ones in the list above. And, these might be best integrated (especially
integrity
) with some global option. I'd like to get use-case feedback and use that to motivate how this is designed.The text was updated successfully, but these errors were encountered: