Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Automatically inject theme CSS class name to body elements in storefront (#12730)

Damian Legawiec2723ec411d90
diff --git a/storefront/app/views/layouts/spree/checkout.html.erb b/storefront/app/views/layouts/spree/checkout.html.erb
index ff67ccbfbb..dba0143f0c 100644
--- a/storefront/app/views/layouts/spree/checkout.html.erb
+++ b/storefront/app/views/layouts/spree/checkout.html.erb
@@ -8,7 +8,7 @@
<%= render 'spree/shared/head' %>
<%= render 'spree/shared/custom_head' %>
</head>
- <body id="checkout-page" class="w-full bg-background text-text">
+ <body id="checkout-page" class="theme-<%= current_theme.class.name.demodulize.underscore %> w-full bg-background text-text">
<%= render_storefront_partials(:body_start_partials) %>
<%= current_store.storefront_custom_code_body_start&.html_safe %>
diff --git a/storefront/app/views/layouts/spree/storefront.html.erb b/storefront/app/views/layouts/spree/storefront.html.erb
index 6e7b5fad21..054046eebd 100644
--- a/storefront/app/views/layouts/spree/storefront.html.erb
+++ b/storefront/app/views/layouts/spree/storefront.html.erb
@@ -6,7 +6,7 @@
<%= render 'spree/shared/json_ld' %>
<%= current_store.storefront_custom_code_head&.html_safe %>
</head>
- <body class="bg-background w-full text-text <%= current_page&.slug %>-page <% if current_theme_preview.present? %>inside-page-builder<% end %>">
+ <body class="theme-<%= current_theme.class.name.demodulize.underscore %> bg-background w-full text-text <%= current_page&.slug %>-page <% if current_theme_preview.present? %>inside-page-builder<% end %>">
<%= render_storefront_partials(:body_start_partials) %>
<%= current_store.storefront_custom_code_body_start&.html_safe %>