Makes wicked-pdf config env dependent

This commit is contained in:
filipefurtad0
2022-09-15 12:12:47 +01:00
parent 584430d64b
commit e4cceffd5c

View File

@@ -1,9 +1,21 @@
Rails.application.reloader.to_prepare do
WickedPdf.config = {
#:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf',
#:layout => "pdf.html",
:exe_path => `bundle exec which wkhtmltopdf`.chomp
}
if Rails.env.test?
Rails.application.reloader.to_prepare do
WickedPdf.config = {
#:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf',
#:layout => "pdf.html",
:page_size => 'A3',
:exe_path => `bundle exec which wkhtmltopdf`.chomp
}
end
else
Rails.application.reloader.to_prepare do
WickedPdf.config = {
#:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf',
#:layout => "pdf.html",
:page_size => 'A4', # default
:exe_path => `bundle exec which wkhtmltopdf`.chomp
}
end
end
# A monkey-patch to remove WickedPdf's monkey-patch, as it clashes with ViewComponents.