2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
module DeferScriptTagHelper
|
2021-01-29 00:20:46 +05:30
|
|
|
# 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-09-10 17:25:29 +05:30
|
|
|
def javascript_include_tag(*sources)
|
|
|
|
super(*sources, defer: true)
|
|
|
|
end
|
|
|
|
end
|