Skip to content

Commit

Permalink
Merge pull request #293 from projectblacklight/install_skip_assets
Browse files Browse the repository at this point in the history
add --skip-assets option to blacklight_range_limit:install generator
  • Loading branch information
seanaery authored Nov 26, 2024
2 parents e843f41 + d3896ee commit 0d16d99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
5 changes: 4 additions & 1 deletion lib/generators/blacklight_range_limit/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d16d99

Please sign in to comment.