Sha256: 47145ee93ae71f79bcae8f7701ff2468f7343c3f3721b7349eb3b883b551beb3

Contents?: true

Size: 1.04 KB

Versions: 14

Compression:

Stored size: 1.04 KB

Contents

require "rails/engine"
require "view_component"

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

    COLLAPSE_DIRS = %w[base]

    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}/base/**/*.rb").each do |path|
          autoloader.collapse(File.dirname(path))
        end

        Dir.glob("#{coco_dir}/{app,book}/{blocks,elements,layouts}/**/*.rb").each do |path|
          autoloader.collapse(File.dirname(path))
        end
      end

      Rails.application.config.to_prepare do
        Rails.autoloaders.main.eager_load_dir(coco_dir)
      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

14 entries across 14 versions & 1 rubygems

Version Path
coveragebook_components-0.6.5 lib/coco/engine.rb
coveragebook_components-0.6.4 lib/coco/engine.rb
coveragebook_components-0.6.3 lib/coco/engine.rb
coveragebook_components-0.6.2 lib/coco/engine.rb
coveragebook_components-0.6.1 lib/coco/engine.rb
coveragebook_components-0.6.0 lib/coco/engine.rb
coveragebook_components-0.5.7 lib/coco/engine.rb
coveragebook_components-0.5.6 lib/coco/engine.rb
coveragebook_components-0.5.5 lib/coco/engine.rb
coveragebook_components-0.5.4 lib/coco/engine.rb
coveragebook_components-0.5.3 lib/coco/engine.rb
coveragebook_components-0.5.2 lib/coco/engine.rb
coveragebook_components-0.5.1 lib/coco/engine.rb
coveragebook_components-0.5.0 lib/coco/engine.rb