Skip to content

Commit 629da53

Browse files
authored
Merge pull request #464 from rails/flavorjones-proper-v4-support
Introduce proper v4 support for new apps
2 parents 731d5c4 + 67a17e0 commit 629da53

File tree

17 files changed

+28
-289
lines changed

17 files changed

+28
-289
lines changed

.github/workflows/ci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ jobs:
3737
fail-fast: false
3838
matrix:
3939
plat: ["ubuntu", "windows", "macos"]
40-
tailwind: ["--version=~>3.4.14", "--version=~>4.0.0.alpha.27"]
4140
runs-on: ${{matrix.plat}}-latest
42-
env:
43-
TAILWINDCSSOPTS: ${{ matrix.tailwind }}
4441
steps:
4542
- uses: actions/checkout@v4
4643
- uses: ruby/setup-ruby@v1

.github/workflows/upstream.yml

-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ jobs:
4242
matrix:
4343
plat: ["ubuntu"]
4444
ref: ["7-2-stable", "8-0-stable", "main"]
45-
tailwind: ["--version=~>3.4.14", "--version=~>4.0.0.alpha.27"]
4645
env:
4746
RAILSOPTS: --git=https://github.com/rails/rails --ref=${{ matrix.ref }}
48-
TAILWINDCSSOPTS: ${{ matrix.tailwind }}
4947
steps:
5048
- uses: actions/checkout@v4
5149
- uses: ruby/setup-ruby@v1

Gemfile.lock

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PATH
33
specs:
44
tailwindcss-rails (3.3.0)
55
railties (>= 7.0.0)
6-
tailwindcss-ruby
6+
tailwindcss-ruby (~> 4.0)
77

88
GEM
99
remote: https://rubygems.org/
@@ -140,12 +140,11 @@ GEM
140140
io-console (~> 0.5)
141141
securerandom (0.4.1)
142142
stringio (3.1.2)
143-
tailwindcss-ruby (3.4.17)
144-
tailwindcss-ruby (3.4.17-aarch64-linux)
145-
tailwindcss-ruby (3.4.17-arm-linux)
146-
tailwindcss-ruby (3.4.17-arm64-darwin)
147-
tailwindcss-ruby (3.4.17-x86_64-darwin)
148-
tailwindcss-ruby (3.4.17-x86_64-linux)
143+
tailwindcss-ruby (4.0.0)
144+
tailwindcss-ruby (4.0.0-aarch64-linux-gnu)
145+
tailwindcss-ruby (4.0.0-arm64-darwin)
146+
tailwindcss-ruby (4.0.0-x86_64-darwin)
147+
tailwindcss-ruby (4.0.0-x86_64-linux-gnu)
149148
thor (1.3.2)
150149
timeout (0.4.3)
151150
tzinfo (2.0.6)

README.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,13 @@ You can also use a local (npm-based) installation if you prefer, please go to ht
5959

6060
### Configuration and commands
6161

62-
#### Configuration file: `config/tailwind.config.js`
63-
64-
You can customize the Tailwind build through the `config/tailwind.config.js` file, just like you would if Tailwind was running in a traditional node installation. All the first-party plugins are supported.
65-
6662
#### Input file: `app/assets/stylesheets/application.tailwind.css`
6763

68-
The installer will generate a Tailwind input file in `app/assets/stylesheets/application.tailwind.css`. This is where you import the plugins you want to use, and where you can setup your custom `@apply` rules.
64+
The installer will generate a Tailwind input file in `app/assets/stylesheets/application.tailwind.css`. This is where you import the plugins you want to use and where you can setup your custom `@apply` rules.
6965

7066
#### Output file: `app/assets/builds/tailwind.css`
7167

72-
When you run `rails tailwindcss:build`, the input file will be used to generate the output in `app/assets/builds/tailwind.css`. That's the output CSS that you'll include in your app (the installer automatically configures this, alongside the Inter font as well).
68+
When you run `rails tailwindcss:build`, the input file will be used to generate the output in `app/assets/builds/tailwind.css`. That's the output CSS that you'll include in your app.
7369

7470
#### Commands
7571

app/assets/stylesheets/inter-font.css

-194
This file was deleted.

lib/generators/tailwindcss/authentication/templates/app/views/passwords/edit.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
<%%= form_with url: password_path(params[:token]), method: :put, class: "contents" do |form| %>
99
<div class="my-5">
10-
<%%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72, class: "block shadow rounded-md border border-gray-400 outline-none focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
10+
<%%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72, class: "block shadow-sm rounded-md border border-gray-400 outline-hidden focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
1111
</div>
1212

1313
<div class="my-5">
14-
<%%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72, class: "block shadow rounded-md border border-gray-400 outline-none focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
14+
<%%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72, class: "block shadow-sm rounded-md border border-gray-400 outline-hidden focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
1515
</div>
1616

1717
<div class="inline">

lib/generators/tailwindcss/authentication/templates/app/views/passwords/new.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<%%= form_with url: passwords_path, class: "contents" do |form| %>
99
<div class="my-5">
10-
<%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address], class: "block shadow rounded-md border border-gray-400 outline-none focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
10+
<%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address], class: "block shadow-sm rounded-md border border-gray-400 outline-hidden focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
1111
</div>
1212

1313
<div class="inline">

lib/generators/tailwindcss/authentication/templates/app/views/sessions/new.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
<%%= form_with url: session_url, class: "contents" do |form| %>
1313
<div class="my-5">
14-
<%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address], class: "block shadow rounded-md border border-gray-400 focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
14+
<%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address], class: "block shadow-sm rounded-md border border-gray-400 focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
1515
</div>
1616

1717
<div class="my-5">
18-
<%%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72, class: "block shadow rounded-md border border-gray-400 focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
18+
<%%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72, class: "block shadow-sm rounded-md border border-gray-400 focus:outline-blue-600 px-3 py-2 mt-2 w-full" %>
1919
</div>
2020

2121
<div class="col-span-6 sm:flex sm:items-center sm:gap-4">

lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
<div class="my-5">
1616
<% if attribute.password_digest? -%>
1717
<%%= form.label :password %>
18-
<%%= form.password_field :password, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password].any?}] %>
18+
<%%= form.password_field :password, class: ["block shadow-sm rounded-md border outline-hidden px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password].any?}] %>
1919
</div>
2020

2121
<div class="my-5">
2222
<%%= form.label :password_confirmation %>
23-
<%%= form.password_field :password_confirmation, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password_confirmation].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password_confirmation].any?}] %>
23+
<%%= form.password_field :password_confirmation, class: ["block shadow-sm rounded-md border outline-hidden px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password_confirmation].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password_confirmation].any?}] %>
2424
<% elsif attribute.attachments? -%>
2525
<%%= form.label :<%= attribute.column_name %> %>
26-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password].any?}] %>
26+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: ["block shadow-sm rounded-md border outline-hidden px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password].any?}] %>
2727
<% else -%>
2828
<%%= form.label :<%= attribute.column_name %> %>
2929
<% if attribute.field_type == :textarea || attribute.field_type == :text_area -%>
30-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
30+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: ["block shadow-sm rounded-md border outline-hidden px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
3131
<% elsif attribute.field_type == :checkbox || attribute.field_type == :check_box -%>
32-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: ["block shadow rounded-md border outline-none mt-2 h-5 w-5", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
32+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: ["block shadow-sm rounded-md border outline-hidden mt-2 h-5 w-5", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
3333
<% else -%>
34-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
34+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: ["block shadow-sm rounded-md border outline-hidden px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
3535
<% end -%>
3636
<% end -%>
3737
</div>

lib/install/application.tailwind.css

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
4-
5-
/*
6-
7-
@layer components {
8-
.btn-primary {
9-
@apply py-2 px-4 bg-blue-200;
10-
}
11-
}
12-
13-
*/
1+
@import "tailwindcss";

lib/install/tailwind.config.js

-22
This file was deleted.

0 commit comments

Comments
 (0)