Sha256: e16d12e7210f20faa2d0c11a3f798dd4bff4c82e99596a0a4e196a09c173fac1

Contents?: true

Size: 1.11 KB

Versions: 20

Compression:

Stored size: 1.11 KB

Contents

require "rails/engine"
require "action_cable/engine"
require "view_component"
require "turbo-rails"

module Coco
  class Engine < ::Rails::Engine
    isolate_namespace Coco

    COLLAPSE_DIRS = %w[shared layout messaging pickers buttons modals navigation utilities typography images indicators embeds]

    config.autoload_paths += %W[
      #{root}/app/components
      #{root}/app/helpers
    ]

    initializer "coco.autoloading" do |app|
      coco_dir = "#{root}/app/components/coco"

      app.autoloaders.each do |autoloader|
        COLLAPSE_DIRS.each do |path|
          autoloader.collapse("#{coco_dir}/#{path}")
        end

        Dir.glob("#{coco_dir}/{#{COLLAPSE_DIRS.join(",")}}/**/*.rb").each do |path|
          autoloader.collapse(File.dirname(path))
        end
      end

      if Rails.env.production?
        Rails.application.config.to_prepare do
          Rails.autoloaders.main.eager_load_dir(coco_dir)
        end
      end
    end

    initializer "coco.assets" do |app|
      if app.config.respond_to?(:assets)
        app.config.assets.precompile += %w[coco/manifest.js *.svg]
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 lib/coco/engine.rb
coveragebook_components-0.19.7 lib/coco/engine.rb
coveragebook_components-0.19.6 lib/coco/engine.rb
coveragebook_components-0.19.5 lib/coco/engine.rb
coveragebook_components-0.19.4 lib/coco/engine.rb
coveragebook_components-0.19.3 lib/coco/engine.rb
coveragebook_components-0.19.2 lib/coco/engine.rb
coveragebook_components-0.19.1 lib/coco/engine.rb
coveragebook_components-0.19.0 lib/coco/engine.rb
coveragebook_components-0.18.8 lib/coco/engine.rb
coveragebook_components-0.18.7 lib/coco/engine.rb
coveragebook_components-0.18.0 lib/coco/engine.rb
coveragebook_components-0.17.7 lib/coco/engine.rb
coveragebook_components-0.17.6 lib/coco/engine.rb
coveragebook_components-0.17.5 lib/coco/engine.rb
coveragebook_components-0.17.4 lib/coco/engine.rb
coveragebook_components-0.17.3 lib/coco/engine.rb
coveragebook_components-0.17.2 lib/coco/engine.rb
coveragebook_components-0.17.1 lib/coco/engine.rb
coveragebook_components-0.17.0 lib/coco/engine.rb