Sha256: d2bef3df946f6cdc0e1302baba63a060faf1700efb947a9d865bc1df74f08bc1

Contents?: true

Size: 584 Bytes

Versions: 7

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

require 'importmap-rails'

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

    def reload!
      importmap_paths.each { |path| SolidusAdmin.importmap.draw(path) }
    end

    private

    def importmap_paths
      SolidusAdmin::Config.importmap_paths
    end

    def updater
      @updater ||= Rails.application.config.file_watcher.new(importmap_paths) { reload! }
    end
  end
end

SolidusAdmin.singleton_class.attr_accessor :importmap
SolidusAdmin.importmap = Importmap::Map.new

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 lib/solidus_admin/importmap.rb
solidus_admin-0.3.1 lib/solidus_admin/importmap.rb
solidus_admin-0.3.0 lib/solidus_admin/importmap.rb
solidus_admin-0.2.0 lib/solidus_admin/importmap.rb
solidus_admin-0.1.0 lib/solidus_admin/importmap.rb
solidus_admin-0.0.2 lib/solidus_admin/importmap.rb
solidus_admin-0.0.1 lib/solidus_admin/importmap.rb