Sha256: 395a280b9bfa05c2624ccd32932a433cd9e0364be12dfa63620df1f917179217

Contents?: true

Size: 654 Bytes

Versions: 4

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

module ::AmberComponent
  # Class which hooks into Rails
  # and configures the application.
  class Railtie < ::Rails::Railtie
    initializer 'amber_component.initialization' do |app|
      app.config.assets.paths << (app.root / 'app' / 'components')

      next if ::Rails.env.production?

      components_root = app.root / 'app' / 'components'
      component_paths = ::Dir[components_root / '**' / '*.rb']
      app.config.eager_load_paths += component_paths

      ::ActiveSupport::Reloader.to_prepare do
        component_paths.each { |file| require_dependency(components_root / file) }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
amber_component-1.0.0 lib/amber_component/railtie.rb
amber_component-0.0.5 lib/amber_component/railtie.rb
amber_component-0.0.4 lib/amber_component/railtie.rb
amber_component-0.0.3 lib/amber_component/railtie.rb