Skip to content

Commit

Permalink
Merge pull request #8849 from jibees/render-pdf-with-stylesheet
Browse files Browse the repository at this point in the history
Create a new method pdf_stylesheet_pack_tag that actually include CSS in PDF files
  • Loading branch information
filipefurtad0 authored Feb 21, 2022
2 parents dbf5eb7 + a951fd2 commit 28ac9d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,13 @@ def body_classes
classes << "off-canvas" unless @hide_menu
classes << @shopfront_layout
end

def pdf_stylesheet_pack_tag(source)
if running_in_development?
options = { media: "all", host: "#{Webpacker.dev_server.host}:#{Webpacker.dev_server.port}" }
stylesheet_pack_tag(source, **options)
else
wicked_pdf_stylesheet_pack_tag(source)
end
end
end
2 changes: 1 addition & 1 deletion app/views/spree/admin/orders/invoice.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= wicked_pdf_stylesheet_pack_tag "mail"
= pdf_stylesheet_pack_tag "mail"

%table{:width => "100%"}
%tbody
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/orders/invoice2.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= wicked_pdf_stylesheet_pack_tag "mail"
= pdf_stylesheet_pack_tag "mail"

%table{:width => "100%"}
%tbody
Expand Down

0 comments on commit 28ac9d9

Please sign in to comment.