PDFs from spatie/laravel-pdf have no CSS when vite is not running #231
-
I create PDFs with spatie/laravel-pdf on Laravel 11, styled with TailwindCSS.
I was working locally with vite running. PDfs were looking great. My deployment includes building the css with
The website renders just fine with the built stylesheets from But: When I deployed my app to my forge server, the PDFs were missing the stylesheet after generation. I tried
and even
This did both not work. But I want to use my build CSS, and not keeping vite running 24/7 on my production server. I think i am missing some fundamental information here. How is this supposed to work? Sry for crossposting from SA, I will update my posts, if i get an answer. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ok, someone found a solution. Just include the CSS inline in the template like this:
https://stackoverflow.com/a/79468205/2956946 I am not sure, if this is the intended behaviour, but it works for me. So I will mark this question as resolved |
Beta Was this translation helpful? Give feedback.
Ok, someone found a solution. Just include the CSS inline in the template like this:
<style>{!! Vite::content('resources/css/app.css') !!}</style>
https://stackoverflow.com/a/79468205/2956946
I am not sure, if this is the intended behaviour, but it works for me. So I will mark this question as resolved