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

Refactor inlineStyles #1601

Merged
merged 1 commit into from Oct 29, 2021
Merged

Refactor inlineStyles #1601

merged 1 commit into from Oct 29, 2021

Conversation

TrySound
Copy link
Member

@TrySound TrySound commented Oct 3, 2021

This is a big one

  • got rid from another closestByName usage
  • delegated removing empty defs elements to removeEmptyContainers plugin
  • got rid from all css-tools usages (most inlineStyles code was there
    for some reason)
  • combined a few loops
  • fixed useMqs option (I would remove it in v3 for simplicity as it
    seems nobody use it)

cc @strarsis

This is a big one

- got rid from another closestByName usage
- delegated removing empty defs elements to removeEmptyContainers plugin
- got rid from all css-tools usages (most inlineStyles code was there
  for some reason)
- combined a few loops
- fixed useMqs option (I would remove it in v3 for simplicity as it
  seems nobody use it)
const cssTools = require('../lib/css-tools');
/**
* @typedef {import('../lib/types').Specificity} Specificity
* @typedef {import('../lib/types').XastElement} XastElement
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm really starting to see the benefits of jsdocs inside a ts project. You can define your types outside, as plain ts files and use on js files :D

@strarsis
Copy link
Contributor

strarsis commented Oct 4, 2021

Ah yes, in the good old times (1, 2 years ago) svgo didn't use any TS features and I tried to isolate the CSS-related stuff into a separate object.
LGTM, lots of code is deduplicated and simplified.

@TrySound TrySound merged commit 72b9722 into master Oct 29, 2021
@TrySound TrySound deleted the refactor-inline-styles branch October 29, 2021 22:31
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

Successfully merging this pull request may close these issues.

None yet

3 participants