diff --git a/app/assets/javascripts/discourse/app/index.html b/app/assets/javascripts/discourse/app/index.html
index 0dde7cb0ab..4a5295d14e 100644
--- a/app/assets/javascripts/discourse/app/index.html
+++ b/app/assets/javascripts/discourse/app/index.html
@@ -20,6 +20,13 @@
{{content-for "head"}}
+
+
+
+ {{content-for "discourse-stylesheets"}}
+
+
+
{{content-for "body"}}
diff --git a/app/assets/javascripts/discourse/lib/bootstrap-json/index.js b/app/assets/javascripts/discourse/lib/bootstrap-json/index.js
index 46c891ecc6..98fc1ed882 100644
--- a/app/assets/javascripts/discourse/lib/bootstrap-json/index.js
+++ b/app/assets/javascripts/discourse/lib/bootstrap-json/index.js
@@ -64,26 +64,6 @@ function head(buffer, bootstrap, headers, baseURL) {
});
buffer.push(``);
- (bootstrap.stylesheets || []).forEach((s) => {
- let attrs = [];
- if (s.media) {
- attrs.push(`media="${s.media}"`);
- }
- if (s.target) {
- attrs.push(`data-target="${s.target}"`);
- }
- if (s.theme_id) {
- attrs.push(`data-theme-id="${s.theme_id}"`);
- }
- if (s.class) {
- attrs.push(`class="${s.class}"`);
- }
- let link = ``;
- buffer.push(link);
- });
-
if (bootstrap.preloaded.currentUser) {
const user = JSON.parse(bootstrap.preloaded.currentUser);
let { admin, staff } = user;
@@ -119,6 +99,28 @@ function beforeScriptLoad(buffer, bootstrap) {
);
}
+function discourseStylesheets(buffer, bootstrap) {
+ (bootstrap.stylesheets || []).forEach((s) => {
+ let attrs = [];
+ if (s.media) {
+ attrs.push(`media="${s.media}"`);
+ }
+ if (s.target) {
+ attrs.push(`data-target="${s.target}"`);
+ }
+ if (s.theme_id) {
+ attrs.push(`data-theme-id="${s.theme_id}"`);
+ }
+ if (s.class) {
+ attrs.push(`class="${s.class}"`);
+ }
+ let link = ``;
+ buffer.push(link);
+ });
+}
+
function body(buffer, bootstrap) {
buffer.push(bootstrap.theme_html.header);
buffer.push(bootstrap.html.header);
@@ -162,6 +164,7 @@ const BUILDERS = {
"before-script-load": beforeScriptLoad,
head,
body,
+ "discourse-stylesheets": discourseStylesheets,
"hidden-login-form": hiddenLoginForm,
preloaded,
"body-footer": bodyFooter,
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 0ab67a126c..3c6f20cbad 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -9,8 +9,6 @@
<%= render partial: "layouts/head" %>
<%= discourse_csrf_tags %>
- <%= render partial: "common/discourse_stylesheet" %>
-
<%- if SiteSetting.enable_escaped_fragments? %>
<%- end %>
@@ -73,6 +71,12 @@
+
+
+ <%= render partial: "common/discourse_stylesheet" %>
+
+
+
<%- if allow_plugins? %>
<%= build_plugin_html 'server:after-body-open' %>
<%- end -%>