I am stuck on the gem wicked_pdf.
- I am generating a pdf report and I want to include stylesheets.
- Stylesheets are generated through webpack with tailwindcss.
In wicked_pdf doc, it is said that I can use wicked_pdf_stylesheet_pack_tag
and wicked_pdf_javascript_pack_tag
to include my stylesheets and javascript from webpack but nothing works.
Here is the code from the controller:
format.pdf do
render template: "pdf_reports/show",
layout: "wicked_layout",
pdf: "report"
end
Here is the code from the layout:
<!DOCTYPE html>
<html>
<head>
<%= csrf_meta_tags %>
<%= wicked_pdf_javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= wicked_pdf_stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= wicked_pdf_stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
</head>
<body>
<%= yield %>
</body>
</html>
Here is the code from the view pdf.erb:
<h1 class="text-red-base">Test pdf</h1>
<h2 class="test-wicked">mldgmdjgfd</h2>
It works with wicked_pdf_stylesheet_link_tag (test-wicked is applied from sprockets: text is blue) but not with wicked_pdf_stylesheet_pack_tag (h1 should be red but is not).
Any idea what's going on?
Thank you!