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

Using vite asset in config file #2

Open
lucraraujo opened this issue Jan 18, 2024 · 1 comment
Open

Using vite asset in config file #2

lucraraujo opened this issue Jan 18, 2024 · 1 comment

Comments

@lucraraujo
Copy link

lucraraujo commented Jan 18, 2024

I know that this doubt should be posted at laravel forums, but I though that it would be a problem that developers who uses this package can face.

When I try to load my CSS asset from Vite in the weasyprint.php config file I get an error.

I'm trying to do something like this:

<?php


use Illuminate\Support\Facades\Vite;

'pdf' => [
        'options' => [
            'stylesheet' => [
                Vite::asset('resources/sass/app.scss')
            ],
        ],
];

But I'm getting this error:

image

Any ideas on how to inject Vite asset in weasyprint?

Thanks!

@lucraraujo
Copy link
Author

I manage to workaraound this issue with the example below:

$pdf = WeasyPrint::loadView('pdftemplate');
$pdf->setOption('stylesheet', [Vite::content('resources/sass/app.scss')]);

The downside is that the assets must be compiled since I could not make it work with URLs.

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

No branches or pull requests

1 participant