From 4ba3e5bbc7f335bf75255bba0b3ca1c5339f3891 Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Fri, 9 Aug 2024 23:41:46 +0200 Subject: [PATCH] Add config/navigation.rb icons detection --- lib/tasks/icons.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/tasks/icons.rake b/lib/tasks/icons.rake index 374ea149fee..26b04b2f23f 100644 --- a/lib/tasks/icons.rake +++ b/lib/tasks/icons.rake @@ -38,6 +38,20 @@ def find_used_icons end end + Rails.root.join('config', 'navigation.rb').open('r') do |file| + pattern = /material_symbol\('(?[^']*)'\)/ + 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