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 CSS patching heuristics #33

Open
pgaskin opened this issue Mar 31, 2020 · 0 comments
Open

Improve CSS patching heuristics #33

pgaskin opened this issue Mar 31, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@pgaskin
Copy link
Owner

pgaskin commented Mar 31, 2020

The CSS minifier and detector have a lot of room for improvement in accuracy, efficiency, and speed.

For the detector:

  • It is slower than it needs to be.
  • It has false-positives for things like SVG documents (fixing this will change the output of cssextract, but it's only intended to be used for extracting CSS in the first place).

For the minifier:

  • It is quite slow.
  • It has quite a few cases where it will replace things incorrectly (i.e. : inside a string) (this bug hasn't ever been hit, but it might as well be fixed).
  • It doesn't do as much as it could. For example, it could:
    • Remove comments.
    • Replace whitespace in more places.
    • Collapse unnecessary repeated whitespace.
    • Spaces around relativity selectors.
    • Etc...
    • Note: Improving this may break some existing patches which depend on replacing previously minified CSS. I'll fix those patches manually if necessary, and do what I can to preserve backwards compatibility where possible (note that this will be the first truly backwards-incompatible change I've ever made in kobopatch).
@pgaskin pgaskin added the enhancement New feature or request label Mar 31, 2020
@pgaskin pgaskin self-assigned this Mar 31, 2020
pgaskin added a commit that referenced this issue Mar 31, 2020
The detection is now faster and more accurate.

This change will change the output of cssextract, as it won't falsely
detect certain SVG streams as CSS anymore, but it wasn't intended
to do so in the first place either way).
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