Sha256: 624cf0e683b043511ec3addbb52e7ddc89930243d2d094d9059121b8fe068e7a

Contents?: true

Size: 497 Bytes

Versions: 9

Compression:

Stored size: 497 Bytes

Contents

require "active_support"
require "active_support/core_ext/module/delegation"

class Importmap::Reloader
  delegate :execute_if_updated, :execute, :updated?, to: :updater

  def reload!
    import_map_paths.each { |path| Rails.application.importmap.draw(path) }
  end

  private
    def updater
      @updater ||= config.file_watcher.new(import_map_paths) { reload! }
    end

    def import_map_paths
      config.importmap.paths
    end

    def config
      Rails.application.config
    end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
importmap-rails-2.0.3 lib/importmap/reloader.rb
importmap-rails-2.0.2 lib/importmap/reloader.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/importmap-rails-2.0.1/lib/importmap/reloader.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/importmap-rails-2.0.1/lib/importmap/reloader.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/importmap-rails-2.0.1/lib/importmap/reloader.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/importmap-rails-2.0.1/lib/importmap/reloader.rb
importmap-rails-2.0.1 lib/importmap/reloader.rb
importmap-rails-2.0.0 lib/importmap/reloader.rb
importmap-rails-1.2.3 lib/importmap/reloader.rb