1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Add config/navigation.rb icons detection

This commit is contained in:
Emelia Smith 2024-08-09 23:41:46 +02:00
parent 28411acebb
commit 4ba3e5bbc7
No known key found for this signature in database

View file

@ -38,6 +38,20 @@ def find_used_icons
end
end
Rails.root.join('config', 'navigation.rb').open('r') do |file|
pattern = /material_symbol\('(?<icon>[^']*)'\)/
file.each_line do |line|
match = pattern.match(line)
next if match.blank?
# navigation.rb only uses 400x24 icons, per material_symbol() in
# app/helpers/application_helper.rb
icons_by_weight_and_size[400] ||= {}
icons_by_weight_and_size[400][24] ||= Set.new
icons_by_weight_and_size[400][24] << match['icon']
end
end
icons_by_weight_and_size
end