lib/importmap/engine.rb in importmap-rails-0.1.3 vs lib/importmap/engine.rb in importmap-rails-0.2.0
- old
+ new
@@ -1,22 +1,27 @@
-require "importmap/paths"
+require "importmap/map"
module Importmap
class Engine < ::Rails::Engine
- config.importmap = ActiveSupport::OrderedOptions.new
- config.importmap.paths = Importmap::Paths.new.tap { |paths| paths.assets_in "app/assets/javascripts" }
+ config.importmap = Importmap::Map.new
config.autoload_once_paths = %W( #{root}/app/helpers )
initializer "importmap.assets" do
if Rails.application.config.respond_to?(:assets)
- Rails.application.config.assets.precompile += %w( es-module-shims )
+ Rails.application.config.assets.precompile += %w( es-module-shims.js )
end
end
initializer "importmap.helpers" do
ActiveSupport.on_load(:action_controller_base) do
helper Importmap::ImportmapTagsHelper
+ end
+ end
+
+ initializer "importmap.map" do
+ Rails.application.config.to_prepare do
+ load Rails.root.join("config/importmap.rb")
end
end
end
end