-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3315 from projectblacklight/install-generator-boo…
…tstrap Update generators to handle Blacklight 8.7.0
- Loading branch information
Showing
10 changed files
with
19 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,26 +31,6 @@ def add_stylesheet_dependencies | |
run 'yarn add leaflet' | ||
end | ||
|
||
# Until https://github.com/projectblacklight/blacklight/pull/3340 is released for BL8 that changes the order of the asset generators, | ||
# we need to replicate some of the behavior of Blacklight::Assets::ImportmapGenerator here, because likely the PropshaftGenerator ran. | ||
def import_blacklight_javascript_assets | ||
pins = { | ||
'@github/auto-complete-element' => 'https://cdn.skypack.dev/@github/auto-complete-element', | ||
'@popperjs/core' => 'https://ga.jspm.io/npm:@popperjs/[email protected]/dist/umd/popper.min.js', | ||
'bootstrap' => "https://ga.jspm.io/npm:bootstrap@#{(defined?(Bootstrap) && Bootstrap::VERSION) || bootstrap_frontend_version}/dist/js/bootstrap.js" | ||
} | ||
|
||
existing_pins = File.readlines('config/importmap.rb') | ||
pins.each do |name, url| | ||
pin_line = "pin \"#{name}\", to: \"#{url}\"" | ||
append_to_file 'config/importmap.rb', "#{pin_line}\n" unless existing_pins.any? { |line| line.include?(name) } | ||
end | ||
end | ||
|
||
def install_sass_bundler | ||
rails_command 'css:install:sass' | ||
end | ||
|
||
# Needed for the stylesheets | ||
def add_frontend | ||
if ENV['CI'] | ||
|
@@ -70,23 +50,10 @@ def add_frontend | |
end | ||
end | ||
|
||
# Until https://github.com/projectblacklight/blacklight/pull/3340 is released for BL8 that changes the order of the asset generators, | ||
# we need to replicate some of the behavior of Blacklight::Assets::ImportmapGenerator here, because likely the PropshaftGenerator ran. | ||
def add_blacklight_javascript | ||
application_js = File.read('app/javascript/application.js') | ||
|
||
imports = [ | ||
'import bootstrap from "bootstrap"', | ||
'import githubAutoCompleteElement from "@github/auto-complete-element"', | ||
'import Blacklight from "blacklight"' | ||
] | ||
|
||
imports.each do |import_line| | ||
append_to_file 'app/javascript/application.js', "#{import_line}\n" unless application_js.include?(import_line) | ||
end | ||
end | ||
|
||
def add_javascript | ||
# This may have been added from Blacklight, but it is a Spotlight dependency so ensure it is present. | ||
insert_into_file 'app/javascript/application.js', "import githubAutoCompleteElement from \"@github/auto-complete-element\"\n" | ||
|
||
append_to_file 'app/javascript/application.js' do | ||
<<~CONTENT | ||
|
@@ -101,7 +68,7 @@ def add_javascript | |
|
||
def add_stylesheets | ||
copy_file 'assets/spotlight.scss', 'app/assets/stylesheets/spotlight.scss' | ||
append_to_file 'app/assets/stylesheets/application.sass.scss' do | ||
append_to_file 'app/assets/stylesheets/application.bootstrap.scss' do | ||
<<~CONTENT | ||
@import "spotlight"; | ||
CONTENT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
// Bootstrap (will use variables defined in customizations, if present) | ||
@import 'bootstrap/scss/bootstrap'; | ||
@import 'spotlight-frontend/app/assets/stylesheets/spotlight/variables_bootstrap'; | ||
|
||
// Blacklight, imported from blacklight-frontend package | ||
@import 'blacklight-frontend/app/assets/stylesheets/blacklight/blacklight'; | ||
|
||
// Leaflet | ||
@import 'leaflet/dist/leaflet'; | ||
|
||
// Spotlight, imported from spotlight-frontend package | ||
@import 'spotlight-frontend/app/assets/stylesheets/spotlight/variables_bootstrap'; | ||
@import 'spotlight-frontend/vendor/assets/stylesheets/bootstrap-tagsinput'; | ||
@import 'spotlight-frontend/vendor/assets/stylesheets/sir-trevor/main'; | ||
@import 'spotlight-frontend/app/assets/stylesheets/spotlight/spotlight'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters