-
Notifications
You must be signed in to change notification settings - Fork 101
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
Use existing CSS #31
Comments
Agreed. |
Hello @PortStone can you give more information? What do you mean by existing css? Thanks. |
I'm guessing this means you can pass styles instead of css links right? That would be neat. Will add that to enhancement. |
@jofftiquez For example i use a CSS loader with webpack and i dont even know the route of the css in my .vue files are in order to pass it to this plugin |
I mean with it that it detects automatically the used CSS and applies it. That means we don't need to add it manually which is a convenient feature. You can see an example package for Angular here: https://github.com/selemxmn/ngx-print#readme |
Am in exactly the same situation |
Found a temporary (maybe permanent) fix 🥳, basically its grabbing stylesheets from window.document and it checks if its inline css or not. If it is inline css converts it to data schema. In both in development and production mode, it works! styles: [
...new Set(
[...window.document.styleSheets]
.map(style => {
return style.href !== null
? style.href
: `data:text/css;base64,${btoa(
unescape(
encodeURIComponent(
[...style.cssRules].map(rule => rule.cssText).join("")
)
)
)}`;
})
.filter(s => s !== null && s !== "data:text/css;base64,")
)
] |
Wow thats a great solution. I have a question, can you do this but with SCSS? |
Pure gold, not all css styles are catched in quasar, but this is a real start point. |
Works! |
Could you add that it uses existing CSS and we don't need to add extra the csss?
The text was updated successfully, but these errors were encountered: