mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-26 23:09:13 +08:00
- Add core_features spec to ensure JS bundles are loaded correctly - Restore data-plugin-name in old plugin system - Fix manifest caching in js_manager - Move *_asset_exists functions into js_manager, and cache in production
28 lines
845 B
Text
Vendored
28 lines
845 B
Text
Vendored
<%# locals: (opts:) %>
|
|
|
|
<%- Discourse.find_plugin_js_assets(opts).tap do |plugin_assets| %>
|
|
<script type="importmap" nonce="<%= csp_nonce_placeholder %>">
|
|
<%= generate_import_map(plugin_assets) %>
|
|
</script>
|
|
|
|
<%- plugin_assets.each do |asset| %>
|
|
<% if asset[:type_module] %>
|
|
<link
|
|
rel="modulepreload"
|
|
href="<%= script_asset_path(asset[:name]) %>"
|
|
nonce="<%= csp_nonce_placeholder %>"
|
|
<%= tag.attributes **asset[:plugin_attributes] %>
|
|
>
|
|
<% else %>
|
|
<%= preload_script asset[:name], attrs: asset[:plugin_attributes] %>
|
|
<% end %>
|
|
<%- end %>
|
|
|
|
<%- plugin_assets.flat_map { it[:imports] }.compact.uniq.each do |import| %>
|
|
<link
|
|
rel="modulepreload"
|
|
href="<%= script_asset_path(import) %>"
|
|
nonce="<%= csp_nonce_placeholder %>"
|
|
>
|
|
<%- end %>
|
|
<%- end %>
|