This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Ruby gem called heroicons-rails that provides Heroicons SVG icons as a Rails component library. The gem allows Rails applications to easily use Heroicons via helper methods.
- Rails Engine: Uses Rails Engine architecture (
lib/heroicons/engine.rb) to integrate with Rails applications - Asset Pipeline: SVG icons are stored in
app/assets/images/icons/with subdirectories for different icon types:outline/- 24x24 outline iconssolid/- 24x24 solid iconsmini/- 20x20 solid iconsmicro/- 16x16 solid icons
- Helper Method: Main functionality provided through
icon_taghelper inapp/helpers/heroicons/application_helper.rb - Generator: Installation generator at
lib/generators/heroicons/install_generator.rbcreates helper file in host applications
rake test # Run all tests
bundle exec rake test # Run tests with bundlerbundle exec rubocop # Run RuboCop linter (uses rubocop-rails-omakase)rake move_to_assets # Move icons from tmp/heroicons to app/assets/images/icons/bundle install # Install dependencies
bundle exec rake # Default task (runs tests)The gem is designed to be included in Rails applications via:
- Add to Gemfile:
gem "heroicons-rails", github: "lab2023/heroicons-rails", branch: "main" - Helper methods are automatically available in views (no generator needed)
- Use in views:
<%= icon_tag :x_mark %>or<%= icon_tag :x_mark, type: :mini, class: "bg-red-500" %>
- Helper methods are automatically included via Rails Engine
config.to_preparehook - No manual installation or generator required
- Generator (
rails g heroicons:install) is optional for custom helper modifications
- Icons are organized by type (outline/solid/mini/micro) corresponding to different sizes and styles from Heroicons
- The
icon_taghelper defaults to:outlinetype and"w-6 h-6"classes - Icon lookup first checks the Rails app's assets, then falls back to the gem's assets
- The
move_to_assetsrake task syncs icons from the upstream Heroicons repository