Sha256: 9c2949098d3aa1bb0822257c88ebf0e38b83467f90b54f45989a8138834a1013

Contents?: true

Size: 1.06 KB

Versions: 17

Compression:

Stored size: 1.06 KB

Contents

module Unpoly
  module Rails
    class Engine < ::Rails::Engine
      initializer 'unpoly-rails.assets' do |app|
        # Some projects may choose to completely remove the asset pipeline from the project.
        # In that case the config.assets accessor is not defined.
        asset_pipeline_active = app.config.respond_to?(:assets)

        if asset_pipeline_active
          # The spec folder only exists for local development,
          # it is not shipped with the .gem package.
          spec_folder = root.join('spec')

          # If a local application has referenced the local gem sources
          # (e.g. `gem 'unpoly', path: '../unpoly'`) we use the local build.
          # This way changes from the Webpack watcher are immediately picked
          # up by the application.
          is_local_gem = spec_folder.directory?
          assets_folder = is_local_gem ? 'unpoly-dev' : 'unpoly'

          # Tell the asset pipeline where to find our assets.
          app.config.assets.paths << root.join('assets', assets_folder).to_s
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
unpoly-rails-2.7.2.2 lib/unpoly/rails/engine.rb
unpoly-rails-2.7.2.1 lib/unpoly/rails/engine.rb
unpoly-rails-2.7.2 lib/unpoly/rails/engine.rb
unpoly-rails-2.7.1.1 lib/unpoly/rails/engine.rb
unpoly-rails-2.7.1 lib/unpoly/rails/engine.rb
unpoly-rails-2.6.1 lib/unpoly/rails/engine.rb
unpoly-rails-2.6.0 lib/unpoly/rails/engine.rb
unpoly-rails-2.5.3 lib/unpoly/rails/engine.rb
unpoly-rails-2.5.2 lib/unpoly/rails/engine.rb
unpoly-rails-2.5.1 lib/unpoly/rails/engine.rb
unpoly-rails-2.5.0 lib/unpoly/rails/engine.rb
unpoly-rails-2.4.1 lib/unpoly/rails/engine.rb
unpoly-rails-2.4.0 lib/unpoly/rails/engine.rb
unpoly-rails-2.3.0 lib/unpoly/rails/engine.rb
unpoly-rails-2.2.1 lib/unpoly/rails/engine.rb
unpoly-rails-2.2.0 lib/unpoly/rails/engine.rb
unpoly-rails-2.2.0.pre.rc1 lib/unpoly/rails/engine.rb