palkan / view_component-contrib

A collection of extension and developer tools for ViewComponent
MIT License
364 stars 21 forks source link

`app:template` did not install default component files correctly. #38

Open helpotters opened 1 year ago

helpotters commented 1 year ago

What did you do?

Ran rails app:template LOCATION="https://railsbytes.com/script/zJosO5".

What did you expect to happen?

For it to install the default component files so it can correctly generate rails g view_component Example later.

What actually happened?

During installation, it failed to set the appropriate file extensions for .haml. Instead of component.html.haml, it made component.html.tt. No errors were raised, leading to it not generating .haml and preview.rb files during rails g view_component Example.

Additional Context

This is not a fresh installation of ViewComponents, I had existing components already.

Environment

I am using HAML and esbuild.

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'
gem 'view_component', '~> 3.5'
gem 'erb2haml', '~> 0.1.5', group: :development
gem 'jsbundling-rails', '~> 1.1'
gem 'cssbundling-rails'
gem 'haml-rails'

Ruby Version:

ruby '3.2.0'

Framework Version (Rails, whatever):

rails 7.0.4

View Component Contrib Version:

"view_component-contrib", "~> 0.1.4"

palkan commented 1 year ago

Hey @helpotters,

Can you please show the contents of the lib/generators/view_component/view_component_generator.rb file generated by the rails app:template ... command?