joseluisq / printd

Print HTML elements or pages in modern browsers.
MIT License
80 stars 5 forks source link

Using css file #15

Closed nicolasturen closed 4 years ago

nicolasturen commented 4 years ago

Hello,

How can I use a css file located at the very same folder that is the .ts file using Printd. I mean, i want to use a sibling css file instead of passing plain text to the print function?. I've tried a lot of path form (absolute, relative), etc.

By the way, thanks a lot for the code! Greetings!

joseluisq commented 4 years ago

Have you take a look at the sample dir on this repo?

Maybe you want something like this:

https://github.com/joseluisq/printd/blob/5bb2403e6b2b6b58c3a4898ac34cac693538acb7/sample/index.ts#L32-L44

If you realize, I'm using an array of different kind of styles (line 35) which includes a file ./base.css.

nicolasturen commented 4 years ago

The problem is that the css file i'm trying to load is being rejected. I got this message at the console:

Refused to apply style from '........../reports/print.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I'm using Angular in my project. Haven't fixed the problem yet. Any ideas?

joseluisq commented 4 years ago

It's would be great if you can share an example to reproduce this.

joseluisq commented 4 years ago

I will close this issue due to inactivity. Feel free to open it again if it's needed.