From d3896ee4b6300f73fc2ee5784a8a47c603d1b320 Mon Sep 17 00:00:00 2001 From: Jonathan Rochkind Date: Mon, 25 Nov 2024 11:27:21 -0500 Subject: [PATCH] add --skip-assets option to blacklight_range_limit:install generator --- README.md | 5 ++++- lib/generators/blacklight_range_limit/install_generator.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5761349e..0abf1830 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,10 @@ Run `rails generate blacklight_range_limit:install` ### Manual Javascript setup is not hard -The installer could have trouble figuring out how to add Javascript to your particular setup. In the end, all you need is `blacklight-range-limit` either importmap-pinned (with its chart.js dependency), or added to your package.json, and then, in a file that has access to the `Blacklight` import: +The installer could have trouble figuring out how to add Javascript to your particular setup. If it's not working right and you want the installer to skip asset generation, you can execute as `rails generate blacklight_range_limit:install --skip-assets`. + + +In the end, all you need is `blacklight-range-limit` either importmap-pinned (with its chart.js dependency), or added to your package.json, and then, in a file that has access to the `Blacklight` import: import BlacklightRangeLimit from "blacklight-range-limit"; BlacklightRangeLimit.init({ onLoadHandler: Blacklight.onLoad }); diff --git a/lib/generators/blacklight_range_limit/install_generator.rb b/lib/generators/blacklight_range_limit/install_generator.rb index a14ca7a5..cfeb2985 100644 --- a/lib/generators/blacklight_range_limit/install_generator.rb +++ b/lib/generators/blacklight_range_limit/install_generator.rb @@ -4,10 +4,13 @@ module BlacklightRangeLimit class InstallGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) + class_option :'skip-assets', type: :boolean, default: false, desc: "Skip generation of assets into app" class_option :'builder-path', type: :string, default: 'app/models/search_builder.rb', aliases: "-b", desc: "Set the path, relative to Rails root, to the Blacklight app's search builder class" def generate_assets - generate 'blacklight_range_limit:assets' + unless options[:'skip-assets'] + generate 'blacklight_range_limit:assets' + end end def install_catalog_controller_mixin