Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wicked PDF with Webpacker does not work when sprockets is not loaded (Rails 6) #857

Open
EdisonArango opened this issue Oct 6, 2019 · 1 comment

Comments

@EdisonArango
Copy link

EdisonArango commented Oct 6, 2019

Issue description

When I have configured webpacker and disabled sprockets in my project with Rails 6 and I use the assets helpers for webpack in the layout:

<%= wicked_pdf_stylesheet_pack_tag "application" %>
<%= wicked_pdf_javascript_pack_tag "application" %>

Then I get the following error:

undefined method `assets' for #<Rails::Application::Configuration:>
Did you mean?  asset_host

This only happens in production or when the webpack dev server is not running.

The problem seems to happen because the helpers check if the assets are compiled by checking:

config.assets.compile

But config.assets is not defined when sprockets is disabled.

System specifications

wicked_pdf gem version: 1.4.0

wkhtmltopdf version: 0.12.4

platform/distribution: Heroku

@EdisonArango EdisonArango changed the title Wicked PDF with Webpack does not work when sprockets is not loaded Wicked PDF with Webpacker does not work when sprockets is not loaded Oct 6, 2019
@EdisonArango
Copy link
Author

EdisonArango commented Oct 6, 2019

This is my workaround while this is solved.

Add this to config/application.rb

AssetsConfig = Struct.new(:enabled, :compile, keyword_init: true)
config.assets = AssetsConfig.new(enabled: false, compile: false)

@EdisonArango EdisonArango changed the title Wicked PDF with Webpacker does not work when sprockets is not loaded Wicked PDF with Webpacker does not work when sprockets is not loaded (Rails 6) Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant