Class: AtomicAssets::Generators::ComponentGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/rails/generators/atomic_assets/component/component_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_component_fileObject



12
13
14
15
16
17
18
# File 'lib/rails/generators/atomic_assets/component/component_generator.rb', line 12

def create_component_file
  @component = OpenStruct.new(
    class_prefix: class_prefix,
    key: file_prefix
  )
  template "component.rb", "app/components/#{file_prefix}_component.rb"
end

#create_scss_fileObject



20
21
22
23
# File 'lib/rails/generators/atomic_assets/component/component_generator.rb', line 20

def create_scss_file
  fullpath = "app/assets/stylesheets/components/_#{file_prefix}.scss"
  template "component.scss", fullpath
end

#create_slim_fileObject



25
26
27
28
# File 'lib/rails/generators/atomic_assets/component/component_generator.rb', line 25

def create_slim_file
  fullpath = "app/views/components/#{file_prefix}.html.slim"
  template "component.slim", fullpath
end