Skip to content

Commit d054855

Browse files
authored
Fix FOUC by moving stylesheets to head (#686)
1 parent 27174c7 commit d054855

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
<% content_for :body_content do %>
2+
<%= react_component "NavigationBarApp" %>
3+
4+
<div class="container mx-auto px-4 flex-grow">
5+
<%= yield %>
6+
</div>
7+
8+
<%= react_component "Footer" %>
9+
10+
<!-- This is a placeholder for ReactOnRails to know where to render the store props for
11+
client side hydration -->
12+
<%= redux_store_hydration_data %>
13+
<% end %>
114
<!DOCTYPE html>
215
<html>
316
<head>
@@ -8,23 +21,12 @@
821
<%= append_stylesheet_pack_tag('stimulus-bundle') %>
922
<%= append_javascript_pack_tag('stimulus-bundle') %>
1023
<%= append_javascript_pack_tag('stores-registration') %>
24+
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
25+
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
1126

1227
<%= csrf_meta_tags %>
1328
</head>
1429
<body class="min-h-screen flex flex-col bg-sky-50 text-gray-700">
15-
<%= react_component "NavigationBarApp" %>
16-
17-
<div class="container mx-auto px-4 flex-grow">
18-
<%= yield %>
19-
</div>
20-
21-
<%= react_component "Footer" %>
22-
23-
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
24-
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
25-
26-
<!-- This is a placeholder for ReactOnRails to know where to render the store props for
27-
client side hydration -->
28-
<%= redux_store_hydration_data %>
30+
<%= yield :body_content %>
2931
</body>
3032
</html>
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
<% content_for :body_content do %>
2+
<%= react_component "NavigationBarApp" %>
3+
4+
<div class="container mx-auto px-4 flex-grow">
5+
<%= yield %>
6+
</div>
7+
8+
<%= react_component "Footer" %>
9+
<% end %>
110
<!DOCTYPE html>
211
<html>
312
<head>
@@ -7,20 +16,13 @@
716

817
<%= append_stylesheet_pack_tag('stimulus-bundle') %>
918
<%= append_javascript_pack_tag('stimulus-bundle') %>
19+
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
20+
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
1021

1122
<%= csrf_meta_tags %>
1223
</head>
1324
<body class="min-h-screen flex flex-col bg-sky-50 text-gray-700">
14-
<%= react_component "NavigationBarApp" %>
15-
16-
<div class="container mx-auto px-4 flex-grow">
17-
<%= yield %>
18-
</div>
19-
20-
<%= react_component "Footer" %>
21-
22-
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
23-
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
25+
<%= yield :body_content %>
2426
</body>
2527
</html>
2628

0 commit comments

Comments
 (0)