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

CSS stylesheet_link_tag doesn't apply #765

Open
ulisescarreonalvarez opened this issue Sep 9, 2018 · 5 comments
Open

CSS stylesheet_link_tag doesn't apply #765

ulisescarreonalvarez opened this issue Sep 9, 2018 · 5 comments

Comments

@ulisescarreonalvarez
Copy link

Hi team,

I have on my layout this:

<!DOCTYPE html>
<html lang="es">
  <head>
    <title>Exa</title>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= stylesheet_link_tag    'exa_app/css/styles.css', media: 'all' ,'data-turbolinks-track': 'reload' %>
  </head>
    <body>
        <%= yield %>
    </body>
</html>

On my controller:

class PdfController < ApplicationController
    def show
        respond_to do |format|
            format.html
            format.pdf do
                render pdf: 'Report',
                template: 'pdf/show.html.erb',
                page_size: 'A4',
                layout: 'pdf.html'
            end
        end
    end
end

The view without the PDF render looks like:

captura de pantalla 2018-09-08 a la s 22 27 32

But when i put the pdf render looks:

captura de pantalla 2018-09-08 a la s 22 27 59

Am i missing something?

@unixmonkey
Copy link
Collaborator

Is exa_app/css/styles.css in your config.assets.precompile list?

Please checkout the section on Helpers and Asset Pipeline usage of the README.

Please let me know if you continue to have trouble.

@ulisescarreonalvarez
Copy link
Author

ulisescarreonalvarez commented Sep 10, 2018

@unixmonkey

The assets exist:

sh-3.2# ls -l app/assets/stylesheets/exa_app/css/styles.css 
-rwxr-xr-x@ 1 ulisescarreon  staff  695081 Sep  7 22:21 app/assets/stylesheets/exa_app/css/styles.css

Rails.application.config.assets.precompile += %w( exa_app/css/styles.css )

If i dont render the pdf and just send the html the invoice style shows fine.

@unixmonkey
Copy link
Collaborator

Does replacing stylesheet_link_tag with wicked_pdf_stylesheet_link_tag help?

@ulisescarreonalvarez
Copy link
Author

Nop, actually doesnt work even with the assets precompiled. :/

@unixmonkey
Copy link
Collaborator

unixmonkey commented Oct 11, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants