Commit d4c8a748 authored by Justin Ho's avatar Justin Ho

Fix styles not loaded when startup_css is enabled

On the Jira Connect app, custom CSS styles were not
loading. This was due to code related to startup_css.
We are using `add_page_specific_style` to include the CSS
which then calls `stylesheet_link_tag_defer`. When
`startup_css` is enabled, the stylesheet is included as
`media: print` which only applies the styles when page is
printed instead of applying them to "all" or "screen".

This change adds a param to the helper which allows us
to disable the `defer` behaviour when not needed and
use that in the jira_connect app.

I also update the order of includes in the jira_connect
layout to group stylesheets and javascripts properly.
parent a0e44758
......@@ -361,9 +361,13 @@ module ApplicationHelper
}
end
def add_page_specific_style(path)
def add_page_specific_style(path, defer: true)
content_for :page_specific_styles do
if defer
stylesheet_link_tag_defer path
else
stylesheet_link_tag path
end
end
end
......
......@@ -63,4 +63,4 @@
= webpack_bundle_tag 'jira_connect_app'
= page_specific_javascript_tag('jira_connect.js')
- add_page_specific_style 'page_bundles/jira_connect'
- add_page_specific_style 'page_bundles/jira_connect', defer: false
......@@ -5,9 +5,10 @@
GitLab
= stylesheet_link_tag 'https://unpkg.com/@atlaskit/css-reset@3.0.6/dist/bundle.css'
= stylesheet_link_tag 'https://unpkg.com/@atlaskit/reduced-ui-pack@10.5.5/dist/bundle.css'
= yield :page_specific_styles
= javascript_include_tag 'https://connect-cdn.atl-paas.net/all.js'
= javascript_include_tag 'https://unpkg.com/jquery@3.3.1/dist/jquery.min.js'
= yield :page_specific_styles
= yield :head
%body
.ac-content
......
---
title: Fix Jira Connect styles not loaded when startup_css is enabled
merge_request: 47043
author:
type: fixed
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