Skip to content

Commit

Permalink
Revert "Expose the original, uncompiled assets in importmaps"
Browse files Browse the repository at this point in the history
This reverts commit b682c57.
  • Loading branch information
jcoyne authored and cbeer committed Nov 18, 2022
1 parent 993d94b commit 26a0b61
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/importmap.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

pin_all_from File.expand_path("../app/javascript", __dir__)
pin_all_from File.expand_path("../app/javascript/blacklight", __dir__)
6 changes: 1 addition & 5 deletions lib/blacklight/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ class Engine < Rails::Engine
end

initializer "blacklight.importmap", before: "importmap" do |app|
if app.config.respond_to?(:importmap)
app.config.assets.precompile += Dir.glob(Engine.root.join("app/javascript/**/*.js"))
app.config.assets.paths << Engine.root.join('app', 'javascript')
app.config.importmap.paths << Engine.root.join("config/importmap.rb")
end
app.config.importmap.paths << Engine.root.join("config/importmap.rb") if app.config.respond_to?(:importmap)
end

bl_global_config = OpenStructWithHashAccess.new
Expand Down
3 changes: 2 additions & 1 deletion lib/generators/blacklight/assets/importmap_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def import_javascript_assets
<<~CONTENT
pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/core@2.11.6/dist/umd/popper.min.js"
pin "bootstrap", to: "https://ga.jspm.io/npm:bootstrap@#{(defined?(Bootstrap) && Bootstrap::VERSION) || '5.2.2'}/dist/js/bootstrap.js"
pin "blacklight", to: "blacklight/blacklight.js"
pin "dialog-polyfill", to: "https://ga.jspm.io/npm:dialog-polyfill@0.5.6/dist/dialog-polyfill.js"
CONTENT
end
Expand All @@ -25,7 +26,7 @@ def append_blacklight_javascript
append_to_file 'app/javascript/application.js' do
<<~CONTENT
import bootstrap from "bootstrap"
import Blacklight from "blacklight"
import "blacklight"
import dialogPolyfill from "dialog-polyfill"
Blacklight.onLoad(() => {
const dialog = document.querySelector('dialog')
Expand Down

0 comments on commit 26a0b61

Please sign in to comment.