Commit 7972bd89 authored by James Lopez's avatar James Lopez

Merge branch '328741-preload-source-editor' into 'master'

Preload monaco globally

See merge request gitlab-org/gitlab!61112
parents 7c87aeab ec0e5cec
......@@ -5,6 +5,10 @@ module WebpackHelper
javascript_include_tag(*webpack_entrypoint_paths(bundle))
end
def webpack_preload_asset_tag(asset, options = {})
preload_link_tag(Gitlab::Webpack::Manifest.asset_paths(asset).first, options)
end
def webpack_controller_bundle_tags
chunks = []
......
......@@ -32,6 +32,8 @@
- if page_canonical_link
%link{ rel: 'canonical', href: page_canonical_link }
= webpack_preload_asset_tag("monaco")
= favicon_link_tag favicon, id: 'favicon', data: { original_href: favicon }, type: 'image/png'
= render 'layouts/startup_css'
......
......@@ -62,6 +62,12 @@ RSpec.describe 'layouts/_head' do
expect(rendered).to match('<link rel="stylesheet" media="print" href="/stylesheets/highlight/themes/solarised-light.css" />')
end
it 'preloads Monaco' do
render
expect(rendered).to match('<link rel="preload" href="/assets/webpack/monaco.chunk.js" as="script" type="text/javascript">')
end
context 'when an asset_host is set and snowplow url is set' do
let(:asset_host) { 'http://test.host' }
let(:snowplow_collector_hostname) { 'www.snow.plow' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment