Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip CSS when creating APIs. #50907

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions railties/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Skip CSS when generating APIs.

*Ruy Rocha*

* Rails console now indicates application name and the current Rails environment:

```txt
Expand Down
1 change: 1 addition & 0 deletions railties/lib/rails/generators/app_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ def dockerfile_deploy_packages
end

def css_gemfile_entry
return if options[:api]
return unless options[:css]

if !using_js_runtime? && options[:css] == "tailwind"
Expand Down
12 changes: 12 additions & 0 deletions railties/test/generators/api_app_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ def test_generator_if_skip_action_mailer_is_given
assert_no_directory "app/views"
end

def test_generator_skip_css
run_generator [destination_root, "--api", "--css=tailwind"]

assert_file "Gemfile" do |content|
assert_no_match(%r/gem "tailwindcss-rails"/, content)
end

assert_no_file "app/views/layouts/application.html.erb" do |content|
assert_no_match(/tailwind/, content)
end
end

def test_app_update_does_not_generate_unnecessary_config_files
run_generator

Expand Down