okeen
okeen

Reputation: 3986

wicked_pdf: ActionView::Template::Error (couldn't find file 'twitter/bootstrap'

We have some PDF generation code working fine in the dev environment, but Rails is showing an error when we try to render it on production:

***************WICKED***************
  Rendered invoices/show.pdf.haml within layouts/invoices_pdf.pdf (8.8ms)
Completed 500 Internal Server Error in 73ms

ActionView::Template::Error (couldn't find file 'twitter/bootstrap'

It fails trying to include the application.css asset in:

!!!
%html
  %head
    %meta{"http-equiv"=>"content-type", :content=>"text/html; charset=utf-8"}
    = wicked_pdf_stylesheet_link_tag "application"

  %body
    .container
      = yield

Upvotes: 5

Views: 2229

Answers (2)

Karan
Karan

Reputation: 15104

Do you have the less-rails-bootstrap under the :asset group in your gemfile? If so, move it out from there, and it might do the job!

Upvotes: 3

Harry
Harry

Reputation: 4835

The css file 'twitter/bootstrap.css' will likely not exist in production, as sprockets will compile it into application.css - this will not be the case in development, however, where sprockets maintains separate files by default.

Are you referencing twitter/bootstrap.css specifically in your code? If so, changing the reference to application.css for production will likely solve the issue.

Upvotes: 3

Related Questions