From e2da72b76c7f49c2c3a159ce48051c4050f3dc3e Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Mon, 18 Mar 2024 20:07:29 +0800 Subject: [PATCH] PERF: Remove unnecessary `` (#26219) Why this change? According to https://web.dev/articles/preload-critical-assets, > By preloading a certain resource, you are telling the browser that you would like to fetch it sooner than the browser would otherwise discover it because you are certain that it is important for the current page. The preload resource hint is meant to tell the browser to fetch resources that it would not discover upfront or early. However, we are not using it the right way because we are literally adding the resource hint right before a ` - HTML - else - <<~HTML.html_safe - - - HTML - end + + <<~HTML.html_safe + + HTML end def add_resource_preload_list(resource_url, type) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 013e7143b41..6526ba884d4 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -5,7 +5,6 @@ RSpec.describe ApplicationHelper do describe "preload_script" do def script_tag(url, entrypoint, nonce) <<~HTML - HTML end