Sha256: e772b70e6e2ff72df9da54b57bf6cbebc1033b9ab8e43e508c4ca010339e8fed
Contents?: true
Size: 492 Bytes
Versions: 9
Compression:
Stored size: 492 Bytes
Contents
require "rails/generators/named_base" class StimulusGenerator < Rails::Generators::NamedBase # :nodoc: source_root File.expand_path("templates", __dir__) def copy_view_files @attribute = stimulus_attribute_value(name) template "controller.js", "app/javascript/controllers/#{name}_controller.js" rails_command "stimulus:manifest:update" if Rails.root.join("package.json").exist? end private def stimulus_attribute_value(name) name.gsub(/\//, "--") end end
Version data entries
9 entries across 9 versions & 1 rubygems