Wicked_pdf: Fail to include CSS assets in production

Created on 1 Apr 2016  路  7Comments  路  Source: mileszs/wicked_pdf

Hello guys,
i am successfully using
<%= wicked_pdf_stylesheet_link_tag "pdf" %>
in development to load my asset. However in production this won't work anymore, and i can't really understand why.

Also opened a stackoverflow issue: http://stackoverflow.com/questions/36354174/including-css-files-in-pdf-using-wicked-pdf-helpers

Most helpful comment

Hey @pastullo, in case you're using the asset pipeline, you should try including the files in your precompile list in config/initializers/assets.rb as described in the Asset pipeline usage section of the README. Then the include helpers should work once you precompile your assets in production

All 7 comments

hey @unixmonkey what do you think about the issue above?
The problem is that in production on rails 4.2 the helper above do not work, which breaks obviously the app while it works great in development.

Maybe i am wrong, but i think that the helper should "just work" also in production and have some kind of simmetry

Did you try wicked_pdf_stylesheet_link_tag "pdf.scss.erb"?

Hey @pastullo, in case you're using the asset pipeline, you should try including the files in your precompile list in config/initializers/assets.rb as described in the Asset pipeline usage section of the README. Then the include helpers should work once you precompile your assets in production

@pastullo I can to precompile your assets in your local machine.

  1. rake assets:clean
  2. rake assets:precompile
    And then you will be able to emulate work wicked_pdf in compiled assets.
    If you don't include your files in your config/initializers/assets.rb then you CSS styles will not apply to your pdf template and you have to add them.

@unixmonkey @dstrus hey guys,
i notice the change in 1.1.0, tested it in production and now
stylesheet_link_tag wicked_pdf_asset_base64('pdf')

just works!

So i guess you fixed it! 馃憤

Oh yeah, wicked_asset_base64 didn't tap into sprockets before that change, but does now. :)

btw @unixmonkey i made a PR to explain a bit better in the readme how to use the asset helpers together with the asset pipeline. I think the readme are not very clear about that.

(https://github.com/mileszs/wicked_pdf/pull/592)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EdouardPan picture EdouardPan  路  6Comments

andheiberg picture andheiberg  路  3Comments

dgdosen picture dgdosen  路  5Comments

amerritt14 picture amerritt14  路  4Comments

lafeber picture lafeber  路  5Comments