Sha256: 810f6d531baf808c608826cc8b17dad49f9489c59e0c0ab90bd16fe9e368bcba

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

# frozen_string_literal: true
module UiComponents
  class Engine < ::Rails::Engine
    initializer 'ui_components.assets.add_load_paths' do |app|
      app.config.assets.paths += self.class.components_paths
      app.config.assets.paths << root.join('vendor/assets/bower_components')
      app.config.assets.paths << root.join('app', 'assets', 'fonts')
    end

    initializer 'ui_components.assets.precompile' do |app|
      app.config.assets.precompile += %w(styleguide.js
                                         styleguide.css)
      app.config.assets.precompile +=
        self.class.components_paths
          .map(&:basename)
          .map { |p| ["#{p}.js", "#{p}.css"] }
          .flatten

      app.config.assets.precompile += %w(chosen/chosen-sprite.png
                                         chosen/chosen-sprite@2x.png)
    end

    def self.components_paths
      Dir[root.join('app/cells/*/')].map { |path| Pathname.new(path) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ad2games-ui_components-2.3.0 lib/ui_components/engine.rb