summaryrefslogtreecommitdiff
path: root/app/helpers/defer_script_tag_helper.rb
blob: be927c67aaa551d5a75ef5962a7d5cbedc70bc1f (plain)
1
2
3
4
5
6
7
8
9
10
# frozen_string_literal: true

module DeferScriptTagHelper
  # Override the default ActionView `javascript_include_tag` helper to support page specific deferred loading.
  # PLEASE NOTE: `defer` is also critical so that we don't run JavaScript entrypoints before the DOM is ready.
  # Please see https://gitlab.com/groups/gitlab-org/-/epics/4538#note_432159769.
  def javascript_include_tag(*sources)
    super(*sources, defer: true)
  end
end