Skip to content

Improve CSS patching heuristics #33

@pgaskin

Description

@pgaskin

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).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions