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

Improve performances using lightningcss #62

Open
gjeusel opened this issue Feb 11, 2025 · 3 comments
Open

Improve performances using lightningcss #62

gjeusel opened this issue Feb 11, 2025 · 3 comments

Comments

@gjeusel
Copy link

gjeusel commented Feb 11, 2025

I wonder if using lightningcss under the hood and distribute pre-compiled binaries would improve performances and ergonomie of the project ?

It would have a great impact on our side, as we generate a huge css for using tailwindcss classes in our templates.

@liZe
Copy link
Member

liZe commented Feb 11, 2025

Hi!

lightningcss is another CSS parser, so using it would mean replacing the whole project code. 😄

Why don’t you use lightningcss instead of tinycss2 in your project?

@gjeusel
Copy link
Author

gjeusel commented Feb 11, 2025

Ho ! Okay, i thought it was a subset, or that there was some logic on top of css parsing applied.
I'm using it in the context of weasyprint pdf generation, hence I don't have control over which css parser to use.
Do you think I should open this discussion on weasyprint directly ?

@liZe
Copy link
Member

liZe commented Feb 11, 2025

I'm using it in the context of weasyprint pdf generation, hence I don't have control over which css parser to use.
Do you think I should open this discussion on weasyprint directly ?

There’s a chapter in the documentation explaining why we use Python and don’t consider speed as one of WeasyPrint’s main goal, I think that we won’t change the library!

That being said, could you please share a stylesheet (here, or by mail if it’s confidential) that takes too much time to parse for you? We can definitely find if there’s a bottleneck we can fix.

(And if you have a complete HTML+CSS sample, we can even profile the whole WeasyPrint + cssselect2 + tinycss2 + pydyf performance.)

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

2 participants