heartcombo / simple_form

Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
http://blog.plataformatec.com.br/tag/simple_form
MIT License
8.21k stars 1.31k forks source link

Install fails when project uses rails/tailwindcss-rails #1806

Closed dinclas closed 2 months ago

dinclas commented 1 year ago

Precheck

Environment

Current behavior

Using tailwindcss-rails causes install to fail. Output:

❯ rails generate simple_form:install

[Simple Form] Simple Form is not configured in the application and will use the default values. Use `rails generate simple_form:install` to generate the Simple Form configuration.
SimpleForm 3 supports Bootstrap and Zurb Foundation 5. If you want a configuration that is compatible with one of these frameworks, then please re-run this generator with --bootstrap or --foundation as an option.
      create  config/initializers/simple_form.rb
       exist  config/locales
      create  config/locales/simple_form.en.yml
Could not find "_form.html.tailwindcss" in any of your source paths. Your current source paths are:
/Users/claudioramos/.rvm/gems/ruby-3.0.0/gems/simple_form-5.1.0/lib/generators/simple_form/templates

This can be reproduced by creating a new project using Tailwind and installing simple form.

rails new simple-form-tailwind-demo --css tailwind && cd simple-form-tailwind-demo
echo "gem 'simple_form'" > Gemfile
bin/bundle
bin/rails generate simple_form:install

Expected behavior

rails generate simple_form:install is expected to identify the template engine correctly and run successfully.

Workaround

Specify the template engine(erb, haml, or slim) in the install command. Example: rails generate simple_form:install -e erb

dinclas commented 1 year ago

This is caused by tailwind-rails setting the template engine as tailwindcss. I've opened an issue there. https://github.com/rails/tailwindcss-rails/issues/246

nashby commented 2 months ago

@dinclas thanks for reporting this! I'm closing this since it's not simple_form's issue.