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

Enhance the processing of invalid CSS #176

Open
benoit74 opened this issue Feb 9, 2024 · 0 comments
Open

Enhance the processing of invalid CSS #176

benoit74 opened this issue Feb 9, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@benoit74
Copy link
Collaborator

benoit74 commented Feb 9, 2024

In Zimit2, we are rewriting CSS (both inline and in plain files).

The process is:

  • parse the CSS with tinycss2 and rewrite each CSS rules based on a fine understanding of their meaning
  • if it fails (probably due to some invalid CSS), rewrite the CSS with simpler regex rules

We might want to push this even further by searching which CSS rule is invalid (tinycss2 is quite tolerant), rewriting all valid ones with the "fine understanding of their meaning" and apply regex rules only to the invalid CSS rules (which have a significant chance to not processed by the browser anyway). This makes sense mostly in the plain file scenario, inline CSS is not expected to contain many rules.

This has already been discussed a bit in #175 where @mgautierfr said:

I have think about that, but not an easy task. We would have to reimplement tinycss2 serialize feature. And on top of that, it is not clear about what to do in case of parsing error. Even tinycss try to be smart and recover error but give up on parsing error (Kozea/tinycss2@main/tinycss2/ast.py#L105-L115).

I consider this is not needed for Zimit2 project completion (at least based on our current understanding of the situation).

@benoit74 benoit74 added the enhancement New feature or request label Feb 9, 2024
@benoit74 benoit74 added this to the later milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant