Move mail css back to be managed by wepack

It wil allow us to remove dependency on `rails-sass`, and `sass` which
are not maintained anymore.
More or less revert this PR: https://github.com/openfoodfoundation/openfoodnetwork/pull/12743
This commit is contained in:
Gaetan Craig-Riou
2026-01-16 15:12:01 +11:00
parent 7e4886ad67
commit 9a90e46b78
12 changed files with 24 additions and 10 deletions

View File

@@ -1 +0,0 @@
@import './mail/all.scss';

View File

@@ -1,3 +0,0 @@
@import '../../../webpacker/css/admin/globals/palette.scss';
@import 'email';
@import 'payments_list';

View File

@@ -76,4 +76,19 @@ module ApplicationHelper
def cache_key_with_locale(key, locale)
Array.wrap(key) + ["v2", locale.to_s, I18nDigests.for_locale(locale)]
end
def pdf_stylesheet_pack_tag(source)
# With shakapacker dev server running, the wicked_pdf_stylesheet_pack_tag will produce a
# relative path, because we don't have `config.action_controller.asset_host`. Relative path
# can't be resolved by `wkhtmltopdf`. So we pass the wepacker dev server host and port to
# the shakapacker helper, so it generates the correct url.
# For more info: https://stackoverflow.com/questions/58490299/how-to-include-css-stylesheet-into-wicked-pdf/60541688#60541688
if running_in_development?
options = { media: "all",
host: "#{Shakapacker.dev_server.host}:#{Shakapacker.dev_server.port}" }
stylesheet_pack_tag(source, **options)
else
wicked_pdf_stylesheet_pack_tag(source)
end
end
end

View File

@@ -5,7 +5,7 @@
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title
= Spree::Config[:site_name]
= stylesheet_link_tag 'mail', media: "screen"
= stylesheet_pack_tag "mail", media: "screen"
%body{:bgcolor => "#FFFFFF" }
- unless @hide_ofn_navigation
%table.head-wrap

View File

@@ -1,4 +1,4 @@
= wicked_pdf_stylesheet_link_tag "mail"
= pdf_stylesheet_pack_tag "mail"
%table{:width => "100%"}
%tbody

View File

@@ -1,4 +1,4 @@
= wicked_pdf_stylesheet_link_tag "mail"
= pdf_stylesheet_pack_tag "mail"
%table{:width => "100%"}
%tbody

View File

@@ -1,4 +1,4 @@
= wicked_pdf_stylesheet_link_tag "mail"
= pdf_stylesheet_pack_tag "mail"
%table{:width => "100%"}
%tbody
@@ -102,4 +102,4 @@
= render partial: 'spree/admin/orders/_invoice/order_note'
.text-center
= link_to_platform_terms
= link_to_platform_terms

View File

@@ -0,0 +1,3 @@
@import '../admin/globals/palette.scss';
@import 'email';
@import 'payments_list';

View File

@@ -0,0 +1 @@
@import "../css/mail/all.scss";

View File

@@ -19,6 +19,5 @@ Rails.application.config.assets.precompile += [
'web/all.js',
'darkswarm/all.js',
'shared/*',
'mail.scss',
'*.jpg', '*.jpeg', '*.png', '*.gif' '*.svg',
]