Skip to content

How to tailwindcss (I'm using rails 7 api with tailwindcss-rails) in html templates to generate wicked pdf #1126

@atif

Description

@atif

Issue description

I am struggling to use tailwindcss to generate html files using tailwindcss - I've setup the asset_host to load images but not all tailwind styles are loaded - here's my code

<!DOCTYPE html>
<html>
  <head>
    <title>PDF</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta charset="utf-8">
    <%= csp_meta_tag %>
    <%= wicked_pdf_stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
    <%= wicked_pdf_stylesheet_link_tag "application", "data-turbo-track": "reload" %>
  </head>
  <body>
    <main class="container mx-auto flex flex-col">
      <%= yield %>
    </main>
  </body>
</html>

I am using some custom tailwind classes as well like h-[200px] etc.

Expected or desired behavior

Html page should be loaded with all tailwind css styles

System specifications

MacOS 14.4.1 (23E224), M1 Pro

wicked_pdf gem version (output of cat Gemfile.lock | grep wicked_pdf): 2.8.1

wkhtmltopdf version (output of wkhtmltopdf --version): 0.12.6

whtmltopdf provider gem and version if one is used:

platform/distribution and version (e.g. Windows 10 / Ubuntu 16.04 / Heroku cedar): MacOS 14.4.1 (23E224), M1 Pro

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions