Skip to content

Instantly share code, notes, and snippets.

@DavidColby
Created November 29, 2020 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidColby/49a99e51c8f31217254438e30012dd56 to your computer and use it in GitHub Desktop.
Save DavidColby/49a99e51c8f31217254438e30012dd56 to your computer and use it in GitHub Desktop.
Generator for custom Stimulus generator
class StimulusGenerator < Rails::Generators::NamedBase
source_root File.expand_path('templates', __dir__)
def create_controller
template('controller.js', File.join("app/javascript/controllers/#{file_name}_controller.js"))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment