Skip to content

Commit

Permalink
Add skip_manifest option to generator (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBerthier authored Jul 27, 2023
1 parent 70998f6 commit 6b1fd8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/generators/stimulus/stimulus_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
class StimulusGenerator < Rails::Generators::NamedBase # :nodoc:
source_root File.expand_path("templates", __dir__)

class_option :skip_manifest, type: :boolean, default: false, desc: "Don't update the stimulus manifest"

def copy_view_files
@attribute = stimulus_attribute_value(controller_name)
template "controller.js", "app/javascript/controllers/#{controller_name}_controller.js"
rails_command "stimulus:manifest:update" unless Rails.root.join("config/importmap.rb").exist?
rails_command "stimulus:manifest:update" unless Rails.root.join("config/importmap.rb").exist? || options[:skip_manifest]
end

private
Expand Down

0 comments on commit 6b1fd8f

Please sign in to comment.