Improve font optimizer to exclude telephony, mailer strings#11487
Merged
Improve font optimizer to exclude telephony, mailer strings#11487
Conversation
changelog: Internal, Automated Tooling, Exclude telephony strings from font glyph scraper
aduth
commented
Nov 8, 2024
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 |
Contributor
Author
There was a problem hiding this comment.
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.
aduth
commented
Nov 8, 2024
|
|
||
| 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, '') |
Contributor
Author
There was a problem hiding this comment.
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/"
zachmargolis
approved these changes
Nov 12, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 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_glyphssucceeds.