nestjs-pdf icon indicating copy to clipboard operation
nestjs-pdf copied to clipboard

CSS don't load

Open ismailkoksal opened this issue 3 years ago • 4 comments

I can't load my css

Project structure

src/
templates/
  index/
    css/
      style.css
    html.hbs

app.module.ts

PDFModule.register({
      isGlobal: true,
      view: {
        root: join(__dirname, '..', 'templates'),
        engine: 'handlebars',
        extension: 'hbs',
      },
    }),

html.hbs

<html>
<head>
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
  <link href="css/style.css" rel="stylesheet">
</head>
<body>
  <h1 class="red">Hello World</h1>
</body>
</html>

style.css

.red {
  color: red;
}

ismailkoksal avatar Apr 08 '21 14:04 ismailkoksal

@ismailkoksal Did you solve this?

dacxjo avatar May 24 '21 10:05 dacxjo

@ismailkoksal Did you solve this?

@dacxjo No, i decided to put CSS in the HBS file.

ismailkoksal avatar May 25 '21 12:05 ismailkoksal

HI,

this is working for me:

> root/
  > assets/
       > stylesheets/
            > style.css

file.pug:

head meta(charset="UTF-8") meta(name="viewport", content="width=device-width, initial-scale=1.0") style include ../stylesheets/style.css

telou1 avatar Jan 17 '22 21:01 telou1

Thanks but I have uninstalled this package, instead, I'm using puppeteer with his pdf method to generate my documents

dacxjo avatar Jan 17 '22 22:01 dacxjo