8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/generators/govuk_publishing_components/component_generator.rb', line 8
def copy_component_files
@public_name = file_name.dasherize
@component_prefix = "app-c-"
component_directory_name = GovukPublishingComponents::Config.component_directory_name
template_dir = "app/views/#{component_directory_name}/"
docs_dir = "app/views/#{component_directory_name}/docs/"
scss_dir = "app/assets/stylesheets/#{component_directory_name.dasherize}/"
create_directory_if_not_exists(template_dir)
create_directory_if_not_exists(docs_dir)
create_directory_if_not_exists(scss_dir)
template "_component.html.erb", "#{template_dir}_#{@public_name.gsub('-', '_')}.html.erb"
template "component.yml.erb", "#{docs_dir}#{@public_name.gsub('-', '_')}.yml"
template "_component.scss", "#{scss_dir}_#{@public_name}.scss"
end
|