Class: Geoblacklight::AssetsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Geoblacklight::AssetsGenerator
- Defined in:
- lib/generators/geoblacklight/assets_generator.rb
Overview
Set up the delivery strategies for CSS and JS assets.
Instance Method Summary collapse
-
#add_customizations ⇒ Object
Add the CSS customization override stylesheet.
-
#add_geoblacklight_js ⇒ Object
Import Geoblacklight’s JS using the name that importmap has pinned.
-
#add_geoblacklight_styles ⇒ Object
Add Geoblacklight’s stylesheet.
-
#use_bootstrap_esm ⇒ Object
Switch Blacklight’s bootstrap and popper imports to ESM versions so we can import individual modules.
Instance Method Details
#add_customizations ⇒ Object
Add the CSS customization override stylesheet
40 41 42 43 |
# File 'lib/generators/geoblacklight/assets_generator.rb', line 40 def add_customizations copy_file "assets/customizations.css", "app/assets/stylesheets/customizations.css" append_to_file "app/assets/stylesheets/application.css", "\n@import url(\"customizations.css\");" end |
#add_geoblacklight_js ⇒ Object
Import Geoblacklight’s JS using the name that importmap has pinned
30 31 32 |
# File 'lib/generators/geoblacklight/assets_generator.rb', line 30 def add_geoblacklight_js append_to_file "app/javascript/application.js", 'import Geoblacklight from "geoblacklight";' end |
#add_geoblacklight_styles ⇒ Object
Add Geoblacklight’s stylesheet
35 36 37 |
# File 'lib/generators/geoblacklight/assets_generator.rb', line 35 def add_geoblacklight_styles append_to_file "app/assets/stylesheets/application.css", "@import url(\"geoblacklight.css\");" end |
#use_bootstrap_esm ⇒ Object
Switch Blacklight’s bootstrap and popper imports to ESM versions so we can import individual modules
24 25 26 27 |
# File 'lib/generators/geoblacklight/assets_generator.rb', line 24 def use_bootstrap_esm gsub_file "config/importmap.rb", %r{dist/js/bootstrap.js}, "dist/js/bootstrap.esm.js" gsub_file "config/importmap.rb", %r{dist/umd/popper.min.js}, "dist/esm/popper.js" end |