mileszs / wicked_pdf

PDF generator (from HTML) plugin for Ruby on Rails
http://www.mileszs.com/wicked-pdf-plugin
MIT License
3.54k stars 646 forks source link

Adding images to stylesheet #571

Open roelstorms opened 8 years ago

roelstorms commented 8 years ago

Hi,

I am trying to add background images to the stylesheets. I include the stylesheet with: <%= stylesheet_link_tag wicked_pdf_asset_base64("reporting_template/report.css") %> However from the wicked_pdf_helper.rb it seems that the contents of the stylesheet file is not processed by a wicked helper to resolve references to images. Is this correct? How can I reference images from css files correctly?

Kind regards,

Roel Storms

roelstorms commented 8 years ago

Hi,

I solved my own problem by renaming the CSS file to css.scss and using (still reference to the .css file in your html template.): background-image: asset-data-url("imagename.png");

It will search for the images in the app/assets/images directory. I'm not very familiar with ruby, this might have been obvious to most of you.

Kind regards,

Roel Storms

txssseal commented 8 years ago

this issue should be closed @roelstorms