Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/generators/blacklight/assets_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ def appease_rails7
return unless Rails.version > '7'

gem "sassc-rails", "~> 2.1"

remove_file 'app/javascript/application.js'
end

# Add sprockets javascript if needed
Expand All @@ -37,7 +35,7 @@ def create_sprockets_javascript
# Remove the empty generated app/assets/images directory. Without doing this,
# the default Sprockets 4 manifest will raise an exception.
def appease_sprockets4
return if !defined?(Sprockets::VERSION) || Sprockets::VERSION < '4'
return if !defined?(Sprockets::VERSION) || Sprockets::VERSION < '4' || using_importmap?

append_to_file 'app/assets/config/manifest.js', "\n//= link application.js"
empty_directory 'app/assets/images'
Expand Down Expand Up @@ -74,6 +72,14 @@ def assets

private

def root
@root ||= Pathname(destination_root)
end

def using_importmap?
@using_importmap ||= root.join('config/importmap.rb').exist?
end

def turbolinks?
@turbolinks ||= application_js.include?('turbolinks')
end
Expand Down