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

♻️ Refine icon font detection #1148

Merged
merged 10 commits into from
Feb 25, 2021
Merged

♻️ Refine icon font detection #1148

merged 10 commits into from
Feb 25, 2021

Conversation

lluerich
Copy link
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
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
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
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.

@@ -35,7 +43,7 @@ export class NoIconFontIsUsed extends Rule {
run({ $ }: Context) {
// 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
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
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
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