-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Make ScriptTagHelper work with defer and async script tags. #5168
Comments
@NTaylorMullen @DamianEdwards any chance of us actually doing something here? Is the answer that if you need to do more advanced |
We could potentially do something here but the "right" thing would have to be investigated. That ranges from collecting script tags on a page and then collectively rendering them or changing our script injection logic to utilize the DOM. Both these solutions become possible once defer/async come into the picture. Doing this also depends on if we want to invest the time because your latter suggestion is also accurate. |
Yeah I have a feeling that if our script tag helper has to render like 10-15 lines of complex JS code then this isn't the right avenue... |
What if we only do these things if the |
Is this even worth it then? Just don't use our tag helpers? We could certainly build an extensibility system but it seems easier to just write the code yourself... or write your own tag helpers... ? |
Yeah it might be better to just tackle the addition of |
Given our plans in #5728 to improve the experience of adding scripts in general, I'm closing this issue. |
Script tags have the ability to provide an async/defer attribute to modify the timing on when they're loaded into the page. This behavior breaks our expectations for our
ScriptTagHelper
and you end up with both the base script and the fallback script loaded.We should design a route for our script load detection logic to work when these two parameters are present.
The text was updated successfully, but these errors were encountered: