mirror of
https://github.com/tuna/mirror-web.git
synced 2025-12-25 20:32:46 +00:00
fix legacy script tag generation
This commit is contained in:
parent
3fb7919da8
commit
41618e6ed1
|
|
@ -1,5 +1,8 @@
|
|||
{% capture entry %}{% if page.layout and layout.jsEntry %}{{ layout.jsEntry }}{% elsif page.jsEntry %}{{ page.jsEntry }}{% else %}default{% endif %}{% endcapture %}
|
||||
{% vite_javascript_tag {{ entry }} %}
|
||||
{% capture entry_legacy %}{{ entry }}-legacy.js{% endcapture %}
|
||||
<script src="{% vite_asset_path /vite/legacy-polyfills-legacy %}" defer nomodule></script>
|
||||
<script src="{% vite_asset_path {{ entry_legacy }} %}" defer nomodule></script>
|
||||
<script nomodule>
|
||||
!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();
|
||||
</script>
|
||||
<script src="{% vite_asset_path /vite/legacy-polyfills-legacy %}" crossorigin="anonymous" id="vite-legacy-polyfill" nomodule></script>
|
||||
{% capture legacyFile %}{% vite_asset_path {{ entry }}-legacy.js %}{% endcapture %}
|
||||
<script nomodule defer>System.import({{ legacyFile | jsonify }});</script>
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ protected
|
|||
|
||||
# Internal: Renders HTML attributes inside a tag.
|
||||
def stringify_attrs(**attrs)
|
||||
attrs.map { |key, value| %(#{ key }="#{ value }") }.join(' ')
|
||||
attrs.map { |key, value| %(#{ key }#{ value && value != "" ? %(="#{value}") : "" }) }.join(' ')
|
||||
end
|
||||
|
||||
# Internal: Renders an HTML tag of the specified type.
|
||||
|
|
|
|||
Loading…
Reference in New Issue