Sha256: 50ad8a8f8773368a9f04c0699bdef9bee1949a82deb2ae1efee0d6b1bde133f6

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require "rails/engine"

require "view_component"
require "ariadne/classify/utilities"

module Ariadne
  module ViewComponents
    # :nodoc:
    class Engine < ::Rails::Engine
      isolate_namespace Ariadne::ViewComponents
      config.eager_load_paths = ["#{root}/app/components", "#{root}/app/lib"]

      config.ariadne_view_components = ActiveSupport::OrderedOptions.new

      config.ariadne_view_components.raise_on_invalid_options = true
      config.ariadne_view_components.silence_deprecations = false
      config.ariadne_view_components.silence_warnings = false
      config.ariadne_view_components.validate_class_names = true
      config.ariadne_view_components.raise_on_invalid_aria = true

      initializer "ariadne_view_components.assets" do |app|
        app.config.assets.precompile += ["ariadne_view_components"] if app.config.respond_to?(:assets)
      end

      initializer "ariadne_view_components.importmap", before: "importmap" do |app|
        if Rails.application.respond_to?(:importmap)
          app.config.importmap.paths << Engine.root.join("config/importmap.rb")
        end
      end

      config.after_initialize do |app|
        ::Ariadne::Classify::Utilities.validate_class_names = app.config.ariadne_view_components.delete(:validate_class_names)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.6 lib/ariadne/view_components/engine.rb