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

Can not link external css file #87

Open
db-conception opened this issue Aug 15, 2022 · 6 comments
Open

Can not link external css file #87

db-conception opened this issue Aug 15, 2022 · 6 comments

Comments

@db-conception
Copy link

db-conception commented Aug 15, 2022

Hello,

I am trying to link an external css file. But it doesn't works

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>DECLARATION DE NON-CONDAMNATION et de FILIATION</title>
    <link href="style.css" rel="stylesheet">
  </head>
@0xMelkor
Copy link

0xMelkor commented Sep 6, 2022

Any help out there?

@db-conception
Copy link
Author

db-conception commented Sep 6, 2022

Any help out there?

As temporary solution, I use fs to read the css file, and inject it inside the template using {{ this.styles }}

@db-conception
Copy link
Author

Any help out there?

var fs = require("fs");
var path = require("path");



// get css from style file
const cssRules = fs.readFileSync(
path.join(process.cwd(), "./template/commun/style.css"),
"utf8"
);
// merge computed datas to data object
data.styles = cssRules;

@Caresle
Copy link

Caresle commented Dec 7, 2022

Any help out there?

I can link the css file, but I only test this with the localhost.

<link href="http://localhost:3000/css/style.css" rel="stylesheet"/>

@Isrolik-MorYosef
Copy link

Isrolik-MorYosef commented Jan 5, 2023

@db-conception U can attachment the HTML file?

@Migue98
Copy link

Migue98 commented Feb 1, 2023

In my case, the CSS wasn't loading because it could not load the images.
I mean, there was a error with my images when the PDF was created.
I hope this be useful.

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

5 participants