Add detection and download of material_symbol icons in config/navigation.rb (#31366)
This commit is contained in:
		
					parent
					
						
							
								97db4bd4dd
							
						
					
				
			
			
				commit
				
					
						f397550311
					
				
			
		
					 47 changed files with 60 additions and 23 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue