diff --git a/app/views/layouts/blacklight/base.html.erb b/app/views/layouts/blacklight/base.html.erb index 90b9a7a985..cbdd44021c 100644 --- a/app/views/layouts/blacklight/base.html.erb +++ b/app/views/layouts/blacklight/base.html.erb @@ -12,6 +12,8 @@ <%= opensearch_description_tag application_name, opensearch_catalog_url(format: 'xml') %> <%= favicon_link_tag %> <%= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload" %> + <%= stylesheet_link_tag "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" unless defined? Propshaft %> + <% if defined? Importmap %> <%= javascript_importmap_tags %> <% elsif defined? Propshaft %> diff --git a/lib/generators/blacklight/assets/importmap_generator.rb b/lib/generators/blacklight/assets/importmap_generator.rb index 71dc340afc..62c21abd54 100644 --- a/lib/generators/blacklight/assets/importmap_generator.rb +++ b/lib/generators/blacklight/assets/importmap_generator.rb @@ -10,7 +10,7 @@ def import_javascript_assets <<~CONTENT pin "@github/auto-complete-element", to: "https://cdn.skypack.dev/@github/auto-complete-element" 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.3.2'}/dist/js/bootstrap.js" + pin "bootstrap", to: "https://ga.jspm.io/npm:bootstrap@#{(defined?(Bootstrap) && Bootstrap::VERSION) || '5.3.3'}/dist/js/bootstrap.js" CONTENT end @@ -40,41 +40,19 @@ def append_blacklight_javascript end def add_stylesheet - unless used_bootstrap_css? - generate_with_sassc_rails - return - end - - if ENV['CI'] - run "yarn add file:#{Blacklight::Engine.root}" + if File.exist? 'app/assets/stylesheets/application.bootstrap.scss' + append_to_file 'app/assets/stylesheets/application.bootstrap.scss' do + <<~CONTENT + @import url("blacklight.css"); + CONTENT + end else - run "yarn add blacklight-frontend@#{Blacklight::VERSION}" - end - - append_to_file 'app/assets/stylesheets/application.bootstrap.scss' do - <<~CONTENT - @import "blacklight-frontend/app/assets/stylesheets/blacklight/blacklight"; - CONTENT - end - end - - private - - # Did they generate the rails app with `--css bootstrap' ? - def used_bootstrap_css? - File.exist? 'app/assets/stylesheets/application.bootstrap.scss' - end - - def generate_with_sassc_rails - gem "sassc-rails", "~> 2.1" - # This could be skipped if you want to use shakapacker or cssbunding-rails - gem 'bootstrap', options[:'bootstrap-version'].presence - - create_file 'app/assets/stylesheets/blacklight.scss' do - <<~CONTENT - @import 'bootstrap'; - @import 'blacklight/blacklight'; - CONTENT + append_to_file 'app/assets/stylesheets/application.css' do + <<~CONTENT + @import url("blacklight.css"); + @import stylesheet_path("blacklight.css"); + CONTENT + end end end end diff --git a/lib/generators/blacklight/assets/propshaft_generator.rb b/lib/generators/blacklight/assets/propshaft_generator.rb index 9466fb2327..cf3373cdd0 100644 --- a/lib/generators/blacklight/assets/propshaft_generator.rb +++ b/lib/generators/blacklight/assets/propshaft_generator.rb @@ -18,7 +18,7 @@ def add_third_party_packages def add_package_assets append_to_file 'app/assets/stylesheets/application.bootstrap.scss' do <<~CONTENT - @import "blacklight-frontend/app/assets/stylesheets/blacklight/blacklight"; + @import url("blacklight.css"); CONTENT end diff --git a/lib/generators/blacklight/assets_generator.rb b/lib/generators/blacklight/assets_generator.rb index c2c2735623..a9b9c442a1 100644 --- a/lib/generators/blacklight/assets_generator.rb +++ b/lib/generators/blacklight/assets_generator.rb @@ -2,7 +2,7 @@ module Blacklight class AssetsGenerator < Rails::Generators::Base - class_option :'bootstrap-version', type: :string, default: ENV.fetch('BOOTSTRAP_VERSION', '~> 5.3'), desc: "Set the generated app's bootstrap version" + class_option :'bootstrap-version', type: :string, default: ENV.fetch('BOOTSTRAP_VERSION', '5.3.3'), desc: "Set the generated app's bootstrap version" def run_asset_pipeline_specific_generator generated_options = "--bootstrap-version='#{options[:'bootstrap-version']}'" if options[:'bootstrap-version']