2018-08-18 11:19:57 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-03 20:31:53 +00:00
|
|
|
module DeferScriptTagHelper
|
2020-10-21 06:09:17 +00:00
|
|
|
# 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.
|
2017-08-03 20:31:53 +00:00
|
|
|
def javascript_include_tag(*sources)
|
|
|
|
super(*sources, defer: true)
|
|
|
|
end
|
|
|
|
end
|