Class: Uistiti::ComponentGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Uistiti::ComponentGenerator
- Defined in:
- lib/generators/uistiti/component_generator.rb
Instance Method Summary collapse
- #create_and_import_css ⇒ Object
- #create_controller ⇒ Object
- #create_preview ⇒ Object
- #create_stimulus ⇒ Object
- #create_template ⇒ Object
Instance Method Details
#create_and_import_css ⇒ Object
15 16 17 18 19 |
# File 'lib/generators/uistiti/component_generator.rb', line 15 def create_and_import_css file_path = "app/assets/stylesheets/uistiti/components/#{status_path}#{underscore_name}.scss" template("component.scss.tt", file_path) insert_into_file("app/assets/stylesheets/uistiti/uistiti.scss", "@import \"components/#{status_path}#{underscore_name}\";\n") end |
#create_controller ⇒ Object
7 8 9 |
# File 'lib/generators/uistiti/component_generator.rb', line 7 def create_controller template("component.tt", "app/components/uistiti/#{status_path}#{underscore_name}.rb") end |
#create_preview ⇒ Object
25 26 27 |
# File 'lib/generators/uistiti/component_generator.rb', line 25 def create_preview template("preview.tt", "app/components/previews/uistiti/#{status_path}#{underscore_name}_preview.rb") end |
#create_stimulus ⇒ Object
21 22 23 |
# File 'lib/generators/uistiti/component_generator.rb', line 21 def create_stimulus template("component.js.tt", "app/assets/javascript/controllers/uistiti/#{status_path}#{underscore_name}_controller.js") end |
#create_template ⇒ Object
11 12 13 |
# File 'lib/generators/uistiti/component_generator.rb', line 11 def create_template template("component.html.tt", "app/components/uistiti/#{status_path}#{underscore_name}.html.erb") end |