yarn add bootstrap-icons
Add the library first and then,
//= link_directory ../../../node_modules/bootstrap-icons .svg
add this line (to app/assets/config/manifest.js
file) to use bootstrap-icons.svg
file as follows (if for 'shop' icon)
<svg class="bi" fill="currentColor">
<use xlink:href="<%= asset_path "bootstrap-icons/bootstrap-icons.svg" %>#shop"/>
</svg>
Like "sprite" on this page. https://icons.getbootstrap.com/#usage In this way you can size / change color in simpler way.
UPDATE:
In addition, we can write up a helper in this case.
<%= bi_icon 'shop', class: 'shop-style' %>
.shop-style {
width: 16px; height: 16px; color: red;
}
For above, we can have something like:
def bi_icon(icon, options = {})
klasses = ["bi"].append(options.delete(:class)).compact
content_tag :svg, options.merge(class: klasses, fill: "currentColor") do
content_tag :use, nil, "xlink:href" => "#{ asset_path 'bootstrap-icons/bootstrap-icons.svg' }##{icon}"
end
end