Commit 0c5a0740 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'tz-critical-css-poc' into 'master'

Startup.CSS

See merge request gitlab-org/gitlab!38052
parents 0b8c8c7b 20cf7041
...@@ -7,6 +7,7 @@ scss_files: ...@@ -7,6 +7,7 @@ scss_files:
exclude: exclude:
- 'app/assets/stylesheets/pages/emojis.scss' - 'app/assets/stylesheets/pages/emojis.scss'
- 'app/assets/stylesheets/startup/startup-general.scss'
linters: linters:
# Reports when you use improper spacing around ! (the "bang") in !default, # Reports when you use improper spacing around ! (the "bang") in !default,
......
...@@ -51,3 +51,9 @@ ...@@ -51,3 +51,9 @@
@media print { @media print {
@import 'print'; @import 'print';
} }
/* Rules for overriding cloaking in startup-general.scss */
.container-limited,
.modal-dialog {
display: block;
}
This diff is collapsed.
...@@ -231,6 +231,18 @@ module ApplicationHelper ...@@ -231,6 +231,18 @@ module ApplicationHelper
"#{request.path}?#{options.compact.to_param}" "#{request.path}?#{options.compact.to_param}"
end end
def use_startup_css?
params[:startup_css] == 'true' || cookies['startup_css'] == 'true'
end
def stylesheet_link_tag_defer(path)
if use_startup_css?
stylesheet_link_tag(path, media: "print", onload: "this.onload=null;this.media='all'")
else
stylesheet_link_tag(path, media: "all")
end
end
def outdated_browser? def outdated_browser?
browser.ie? browser.ie?
end end
......
...@@ -49,14 +49,17 @@ ...@@ -49,14 +49,17 @@
= favicon_link_tag favicon, id: 'favicon', data: { original_href: favicon }, type: 'image/png' = favicon_link_tag favicon, id: 'favicon', data: { original_href: favicon }, type: 'image/png'
- if use_startup_css?
%style{ type: "text/css" }
= Rails.application.assets_manifest.find_sources('startup/startup-general.css').first.to_s.html_safe
- if user_application_theme == 'gl-dark' - if user_application_theme == 'gl-dark'
= stylesheet_link_tag "application_dark", media: "all" = stylesheet_link_tag_defer "application_dark"
- else - else
= stylesheet_link_tag "application", media: "all" = stylesheet_link_tag_defer "application"
= stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations'] = stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations']
= stylesheet_link_tag 'performance_bar' if performance_bar_enabled? = stylesheet_link_tag 'performance_bar' if performance_bar_enabled?
= stylesheet_link_tag "highlight/themes/#{user_color_scheme}", media: "all" = stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}"
= Gon::Base.render_data(nonce: content_security_policy_nonce) = Gon::Base.render_data(nonce: content_security_policy_nonce)
......
...@@ -169,6 +169,8 @@ module Gitlab ...@@ -169,6 +169,8 @@ module Gitlab
config.assets.precompile << "application_dark.css" config.assets.precompile << "application_dark.css"
config.assets.precompile << "startup/*.css"
config.assets.precompile << "print.css" config.assets.precompile << "print.css"
config.assets.precompile << "mailer.css" config.assets.precompile << "mailer.css"
config.assets.precompile << "mailer_client_specific.css" config.assets.precompile << "mailer_client_specific.css"
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"prettier-staged-save": "node ./scripts/frontend/prettier.js save", "prettier-staged-save": "node ./scripts/frontend/prettier.js save",
"prettier-all": "node ./scripts/frontend/prettier.js check-all", "prettier-all": "node ./scripts/frontend/prettier.js check-all",
"prettier-all-save": "node ./scripts/frontend/prettier.js save-all", "prettier-all-save": "node ./scripts/frontend/prettier.js save-all",
"stylelint": "yarn stylelint-file 'app/assets/stylesheets/**/*.*' 'ee/app/assets/stylesheets/**/*.*' '!**/vendors/**'", "stylelint": "yarn stylelint-file 'app/assets/stylesheets/**/*.*' 'ee/app/assets/stylesheets/**/*.*' '!app/assets/stylesheets/startup/startup-general.scss' '!**/vendors/**'",
"stylelint-file": "BROWSERSLIST_IGNORE_OLD_DATA=true node node_modules/stylelint/bin/stylelint.js", "stylelint-file": "BROWSERSLIST_IGNORE_OLD_DATA=true node node_modules/stylelint/bin/stylelint.js",
"stylelint-create-utility-map": "node scripts/frontend/stylelint/stylelint-utility-map.js", "stylelint-create-utility-map": "node scripts/frontend/stylelint/stylelint-utility-map.js",
"test": "node scripts/frontend/test", "test": "node scripts/frontend/test",
......
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