Skip to content

Improve font optimizer to exclude telephony, mailer strings#11487

Merged
aduth merged 3 commits intomainfrom
aduth-font-glyphs-exclude-telephony
Nov 12, 2024
Merged

Improve font optimizer to exclude telephony, mailer strings#11487
aduth merged 3 commits intomainfrom
aduth-font-glyphs-exclude-telephony

Conversation

@aduth
Copy link
Copy Markdown
Contributor

@aduth aduth commented Nov 8, 2024

🛠 Summary of changes

Updates our font optimizer tooling to disregard strings used for either telephony or user mailer emails. Since these are used in contexts which do not load the affected web fonts, they shouldn't be considered.

Currently this has no net effect on the characters being used, but this would have prevented a lot of developer toil in #11203 (see related discussion). The hope is that these changes can limit the frequency of needing to regenerate font files.

📜 Testing Plan

Verify that make lint_font_glyphs succeeds.

aduth added 2 commits November 8, 2024 15:40
changelog: Internal, Automated Tooling, Exclude telephony strings from font glyph scraper
@aduth aduth requested review from jmhooper and n1zyy November 8, 2024 20:58
Comment on lines +27 to +29
opts.on('--exclude-path=PATH', 'Disregard characters from the given relative path') do |path|
excluded_paths << File.join(Dir.pwd, path, '')
end
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Technically it'd be possible to exclude telephony strings with --exclude-key-scope=telephony, but this might be slightly more optimized to avoid loading those files at all.


opts.on('--exclude-gem-path=GEM', 'Disregard characters loaded by the given gem') do |gem|
excluded_gem_paths << Gem.loaded_specs[gem].full_gem_path
excluded_paths << File.join(Gem.loaded_specs[gem].full_gem_path, '')
Copy link
Copy Markdown
Contributor Author

@aduth aduth Nov 8, 2024

Choose a reason for hiding this comment

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

The reason for the File.join ending with '' (as with above) is to normalize a trailing slash.

Without, it could be possible for the .start_with? check below to match config/locales/telephony_not_the_one_i_mean/en.yml if given --exclude-path=config/locales/telephony .

File.join('config/locales/telephony', '')
# "config/locales/telephony/"
File.join('config/locales/telephony/', '')
# "config/locales/telephony/"

@aduth aduth merged commit 0c46c4c into main Nov 12, 2024
@aduth aduth deleted the aduth-font-glyphs-exclude-telephony branch November 12, 2024 20:40
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.

2 participants