Sha256: b54155f5eea766fefc1ee9dbdb10732fe6e467ed1a7f9bbc34ce3c2a4036d5e0
Contents?: true
Size: 719 Bytes
Versions: 5
Compression:
Stored size: 719 Bytes
Contents
# frozen_string_literal: true module RailsuiIcon module Helpers include ActionView::Helpers::AssetUrlHelper def icon(name, options = {}) options[:variant] ||= :outline options[:class] = options.fetch(:class, nil) custom_path = resolve_custom_path(options[:custom_path]) result = RailsuiIcon::Icon.render(name: name, variant: options[:variant], options: options, custom_path: custom_path) result.html_safe end private def resolve_custom_path(path) return unless path if Rails.application.config.assets.paths.any? { |p| path.start_with?(p) } path else ActionController::Base.helpers.asset_path(path) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems