"wicked_pdf_stylesheet_pack_tag doesn't work" Code Answer's

You're definitely familiar with the best coding language Ruby that developers use to develop their projects and they get all their queries like "wicked_pdf_stylesheet_pack_tag doesn't work" answered properly. Developers are finding an appropriate answer about wicked_pdf_stylesheet_pack_tag doesn't work related to the Ruby coding language. By visiting this online portal developers get answers concerning Ruby codes question like wicked_pdf_stylesheet_pack_tag doesn't work. Enter your desired code related query in the search bar and get every piece of information about Ruby code related question on wicked_pdf_stylesheet_pack_tag doesn't work. 

wicked_pdf_stylesheet_pack_tag doesn't work

By LiorubyLioruby on Apr 07, 2021
# for more details, read the article from 
# https://stackoverflow.com/questions/58490299/how-to-include-css-stylesheet-into-wicked-pdf

# create pdf_helper.rb in app/helpers and add the following code :
module PdfHelper
  def pdf_stylesheet_pack_tag(source)
    if running_in_development?
      options = { media: "all" }
      wds = Webpacker.dev_server
      options[:host] = "#{wds.host}:#{wds.port}" unless show_as_html?
      stylesheet_pack_tag(source, options)
    else
      wicked_pdf_stylesheet_pack_tag(source)
    end
  end

  def pdf_javascript_pack_tag(source)
    if running_in_development?
      options = {}
      wds = Webpacker.dev_server
      options[:host] = "#{wds.host}:#{wds.port}" unless show_as_html?
      javascript_pack_tag(source, options)
    else
      wicked_pdf_javascript_pack_tag(source)
    end
  end
  
  def show_as_html?
    params[:debug].present?
  end
end

# Then, in the pdf layout (slim)

html
  head
    ...
    = pdf_stylesheet_pack_tag "pdf"
    = pdf_javascript_pack_tag "pdf"
    ...

Add Comment

0

All those coders who are working on the Ruby based application and are stuck on wicked_pdf_stylesheet_pack_tag doesn't work can get a collection of related answers to their query. Programmers need to enter their query on wicked_pdf_stylesheet_pack_tag doesn't work related to Ruby code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about wicked_pdf_stylesheet_pack_tag doesn't work for the programmers working on Ruby code while coding their module. Coders are also allowed to rectify already present answers of wicked_pdf_stylesheet_pack_tag doesn't work while working on the Ruby language code. Developers can add up suggestions if they deem fit any other answer relating to "wicked_pdf_stylesheet_pack_tag doesn't work". Visit this developer's friendly online web community, CodeProZone, and get your queries like wicked_pdf_stylesheet_pack_tag doesn't work resolved professionally and stay updated to the latest Ruby updates. 

Ruby answers related to "wicked_pdf_stylesheet_pack_tag doesn't work"

View All Ruby queries

Ruby queries related to "wicked_pdf_stylesheet_pack_tag doesn't work"

Browse Other Code Languages

CodeProZone