Skip to content

♻️ Refine icon font detection#1148

Merged
sebastianbenz merged 10 commits intoampproject:mainfrom
lluerich:feature/linter-icon-fonts
Feb 25, 2021
Merged

♻️ Refine icon font detection#1148
sebastianbenz merged 10 commits intoampproject:mainfrom
lluerich:feature/linter-icon-fonts

Conversation

@lluerich
Copy link
Copy Markdown
Collaborator

  • adds selectors
  • selector is now case-insensitive
  • print warning instead of failure
  • update copy to match other warnings

@@ -26,6 +26,14 @@ const ICON_FONT_IDENTIFIERS = [
className: "ociton-",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

typo? ociton

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oh sorry, fixed.

fontFamilies: ["icon"],
},
{
className: "icon-",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a super generic name which I wouldn't warn about without the font name.

// check for known classnames
const iconFontCandidates = ICON_FONT_IDENTIFIERS.filter((identifier) => {
return $(`[class*=${identifier.className}]`).length > 0;
return $(`[class*=${identifier.className} i]`).length > 0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity, what does the i do here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

case sensitivity?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Exactly :)

@sebastianbenz sebastianbenz merged commit 376a497 into ampproject:main Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants