Skip to content

Commit c126c6b

Browse files
committed
Rename application.tailwind.css to application.css
Its location is app/assets/tailwind so we don't need to say "tailwind" again. Also update tests, simplify some code, update the README, consolidate the CHANGELOG.
1 parent 894f613 commit c126c6b

File tree

8 files changed

+36
-53
lines changed

8 files changed

+36
-53
lines changed

Diff for: CHANGELOG.md

+13-30
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,39 @@
11
## next / unreleased
22

3-
## v4.0.0.rc3 / 2025-01-27
4-
5-
Everything in v4.0.0.rc2, plus ...
6-
7-
General changes:
8-
9-
- Remove the Inter font assets from the gem. @EricGusmao
10-
- If Propshaft is being used, `app/assets/tailwind` will be excluded from its asset handling. (This was incompletely fixed in RC2.)
11-
12-
13-
## v4.0.0.rc2 / 2025-01-26
14-
15-
Everything in v4.0.0.rc1, plus ...
16-
17-
General changes:
18-
19-
- The location of `application.tailwind.css` has moved from `app/assets/stylesheets` to `app/assets/tailwind`. If Propshaft is being used, `app/assets/tailwind` will be excluded from its asset handling.
3+
## next rc / unreleased
204

21-
Changes to the `tailwindcss:install` task:
22-
23-
- The "tailwind" stylesheet link tag will only be added to the application layout if Propshaft isn't in use and already handling `app/assets/build/tailwind.css`. Previously it was always injected, resulting in the tag being rendered twice if Propshaft was in use.
24-
25-
Changes to the `tailwindcss:upgrade` task:
26-
27-
- The "tailwind" stylesheet link tag will be removed if Propshaft is in use and already handling `app/assets/build/tailwind.css`.
28-
- The file `application.tailwind.css` will be moved from `app/assets/stylesheets` to `app/assets/tailwind`.
5+
- The input file `app/assets/tailwind/application.tailwind.css` has been renamed to `app/assets/tailwind/application.css`.
296

7+
Thanks to @brunoprietog for feedback and advice.
308

31-
## v4.0.0.rc1 / 2025-01-23
9+
## v4.0.0.rc3 / 2025-01-27
3210

3311
### Upgrade to Tailwind CSS v4
3412

3513
General changes:
3614

3715
- Dependency on `tailwindcss-ruby` set to `~> 4.0`.
3816
- The location of (optional) `postcss.config.js` has moved from the `config/` directory to the app root.
17+
- The location of `application.tailwind.css` has moved from `app/assets/stylesheets` to `app/assets/tailwind`. If Propshaft is being used, `app/assets/tailwind` will be excluded from its asset handling.
18+
- The Inter font is no longer packaged with the gem.
3919

4020
Changes to the `tailwindcss:install` task:
4121

4222
- The `tailwindcss:install` task no longer installs `config/tailwind.config.js`.
43-
- The Inter font is no longer packaged with the gem.
44-
- Some Tailwind class names are updated for v4.
23+
- The Inter font is no longer configured in the application layout.
24+
- Some Tailwind class names in the ERB templates are updated for v4.
25+
- The "tailwind" stylesheet link tag will only be added to the application layout if Propshaft isn't in use and already handling `app/assets/build/tailwind.css`. Previously it was always injected, resulting in the tag being rendered twice if Propshaft was in use.
4526

4627
New task `tailwindcss:upgrade` upgrades many apps cleanly:
4728

4829
- Cleans up some things in the generated `config/tailwind.config.js`.
4930
- Runs the upstream upgrader (note: requires `npx` to run the one-time upgrade, but highly recommended).
50-
- Removes references to the Inter font from the application layout.
31+
- Removes configuration for the Inter font from the application layout.
5132
- If present, moves `config/postcss.config.js` to the root directory.
33+
- The "tailwind" stylesheet link tag will be removed if Propshaft is in use and already handling `app/assets/build/tailwind.css`.
34+
- The input file `application.tailwind.css` will be moved from `app/assets/stylesheets` to `app/assets/tailwind`.
5235

53-
Thanks to @EricGusmao and @excid3 for their help and advice on this work.
36+
Thanks to @EricGusmao, @patriciomacadden, and @excid3 for their feedback, contributions, and advice on the v4 release.
5437

5538

5639
## v3.3.1 / 2025-01-23

Diff for: README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Here's what the upgrade task does:
102102

103103
- Cleans up some things in the generated `config/tailwind.config.js`.
104104
- If present, moves `config/postcss.config.js` to the root directory.
105-
- If present, moves `app/assets/stylesheets/application.tailwind.css` to `app/assets/tailwind`.
105+
- If present, moves `app/assets/stylesheets/application.tailwind.css` to `app/assets/tailwind/application.css`.
106106
- Removes unnecessary `stylesheet_link_tag "tailwindcss"` tags from the application layout.
107107
- Removes references to the Inter font from the application layout.
108108
- Runs the upstream upgrader (note: requires `npx` to run the one-time upgrade, but highly recommended).
@@ -119,22 +119,22 @@ $ bin/rails tailwindcss:upgrade
119119
gsub app/views/layouts/application.html.erb
120120
Remove unnecessary stylesheet_link_tag from application layout
121121
gsub app/views/layouts/application.html.erb
122-
Moving application.tailwind.css to /home/user/myapp/app/assets/tailwind
123-
create app/assets/tailwind/application.tailwind.css
122+
Moving /home/user/myapp/app/assets/stylesheets/application.tailwind.css to /home/user/myapp/app/assets/tailwind/application.css
123+
create app/assets/tailwind/application.css
124124
remove app/assets/stylesheets/application.tailwind.css
125125
10.9.0
126126
Running the upstream Tailwind CSS upgrader
127127
run npx @tailwindcss/upgrade@next --force --config /home/user/myapp/config/tailwind.config.js from "."
128128
≈ tailwindcss v4.0.0
129129
│ Searching for CSS files in the current directory and its subdirectories…
130-
│ ↳ Linked `./config/tailwind.config.js` to `./app/assets/tailwind/application.tailwind.css`
130+
│ ↳ Linked `./config/tailwind.config.js` to `./app/assets/tailwind/application.css`
131131
│ Migrating JavaScript configuration files…
132132
│ ↳ The configuration file at `./config/tailwind.config.js` could not be automatically migrated to the new CSS
133133
│ configuration format, so your CSS has been updated to load your existing configuration file.
134134
│ Migrating templates…
135135
│ ↳ Migrated templates for configuration file: `./config/tailwind.config.js`
136136
│ Migrating stylesheets…
137-
│ ↳ Migrated stylesheet: `./app/assets/tailwind/application.tailwind.css`
137+
│ ↳ Migrated stylesheet: `./app/assets/tailwind/application.css`
138138
│ ↳ No PostCSS config found, skipping migration.
139139
│ Updating dependencies…
140140
│ Could not detect a package manager. Please manually update `tailwindcss` to v4.
@@ -167,11 +167,11 @@ We'll try to improve the upgrade process over time, but for now you may need to
167167
168168
### Configuration and commands
169169
170-
#### Input file: `app/assets/tailwind/application.tailwind.css`
170+
#### Input file: `app/assets/tailwind/application.css`
171171
172-
The `tailwindcss:install` task will generate a Tailwind input file in `app/assets/tailwind/application.tailwind.css`. This is where you import the plugins you want to use and where you can setup your custom `@apply` rules.
172+
The `tailwindcss:install` task will generate a Tailwind input file in `app/assets/tailwind/application.css`. This is where you import the plugins you want to use and where you can setup your custom `@apply` rules.
173173
174-
⚠ The location of this file changed in v4, from `app/assets/stylesheets` to `app/assets/tailwind`. The `tailwindcss:upgrade` task will move it for you.
174+
⚠ The location of this file changed in v4, from `app/assets/stylesheets/application.tailwind.css` to `app/assets/tailwind/application.css`. The `tailwindcss:upgrade` task will move it for you.
175175
176176
#### Output file: `app/assets/builds/tailwind.css`
177177
File renamed without changes.

Diff for: lib/install/install_tailwindcss.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
22
CENTERING_CONTAINER_INSERTION_POINT = /^\s*<%= yield %>/.freeze
3-
TAILWIND_ASSET_PATH = Rails.root.join("app/assets/tailwind")
3+
TAILWIND_ASSET_PATH = Rails.root.join("app/assets/tailwind/application.css")
44

55
if APPLICATION_LAYOUT_PATH.exist?
66
unless File.read(APPLICATION_LAYOUT_PATH).match?(/stylesheet_link_tag :app/)
@@ -32,9 +32,9 @@
3232
append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
3333
end
3434

35-
unless TAILWIND_ASSET_PATH.join("application.tailwind.css").exist?
36-
say "Add default #{TAILWIND_ASSET_PATH}/application.tailwind.css"
37-
copy_file "#{__dir__}/application.tailwind.css", TAILWIND_ASSET_PATH.join("application.tailwind.css")
35+
unless TAILWIND_ASSET_PATH.exist?
36+
say "Add default #{TAILWIND_ASSET_PATH}"
37+
copy_file "#{__dir__}/application.css", TAILWIND_ASSET_PATH
3838
end
3939

4040
if Rails.root.join("Procfile.dev").exist?

Diff for: lib/install/upgrade_tailwindcss.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
TAILWIND_CONFIG_PATH = Rails.root.join("config/tailwind.config.js")
22
APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
33
POSTCSS_CONFIG_PATH = Rails.root.join("config/postcss.config.js")
4-
OLD_TAILWIND_ASSET_PATH = Rails.root.join("app/assets/stylesheets")
5-
TAILWIND_ASSET_PATH = Rails.root.join("app/assets/tailwind")
4+
OLD_TAILWIND_ASSET_PATH = Rails.root.join("app/assets/stylesheets/application.tailwind.css")
5+
TAILWIND_ASSET_PATH = Rails.root.join("app/assets/tailwind/application.css")
66

77
unless TAILWIND_CONFIG_PATH.exist?
88
say "Default tailwind.config.js is missing!", :red
@@ -38,10 +38,10 @@
3838
say %( Please check your layouts and remove any "inter-font" stylesheet links.)
3939
end
4040

41-
if OLD_TAILWIND_ASSET_PATH.join("application.tailwind.css").exist?
42-
say "Moving application.tailwind.css to #{TAILWIND_ASSET_PATH}"
43-
copy_file OLD_TAILWIND_ASSET_PATH.join("application.tailwind.css"), TAILWIND_ASSET_PATH.join("application.tailwind.css")
44-
remove_file OLD_TAILWIND_ASSET_PATH.join("application.tailwind.css")
41+
if OLD_TAILWIND_ASSET_PATH.exist?
42+
say "Moving #{OLD_TAILWIND_ASSET_PATH} to #{TAILWIND_ASSET_PATH}"
43+
copy_file OLD_TAILWIND_ASSET_PATH, TAILWIND_ASSET_PATH
44+
remove_file OLD_TAILWIND_ASSET_PATH
4545
end
4646

4747
if system("npx --version")

Diff for: lib/tailwindcss/commands.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def compile_command(debug: false, **kwargs)
88

99
command = [
1010
Tailwindcss::Ruby.executable(**kwargs),
11-
"-i", rails_root.join("app/assets/tailwind/application.tailwind.css").to_s,
11+
"-i", rails_root.join("app/assets/tailwind/application.css").to_s,
1212
"-o", rails_root.join("app/assets/builds/tailwind.css").to_s,
1313
]
1414

Diff for: test/integration/user_install_test.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bin/rails tailwindcss:install
3737

3838
# TEST: tailwind was installed correctly
3939
grep -q "<main class=\"container" app/views/layouts/application.html.erb
40-
test -a app/assets/tailwind/application.tailwind.css
40+
test -a app/assets/tailwind/application.css
4141

4242
# TEST: rake tasks don't exec (#188)
4343
cat <<EOF >> Rakefile
@@ -46,7 +46,7 @@ task :still_here do
4646
end
4747
EOF
4848

49-
cat >> app/assets/tailwind/application.tailwind.css <<EOF
49+
cat >> app/assets/tailwind/application.css <<EOF
5050
@theme { --color-special: #abc12399; }
5151
EOF
5252

@@ -66,7 +66,7 @@ grep -q "Show this post" app/views/posts/index.html.erb
6666
bin/rails tailwindcss:build[verbose]
6767
grep -q "py-2" app/assets/builds/tailwind.css
6868

69-
# TEST: contents include application.tailwind.css
69+
# TEST: contents include application.css directives
7070
grep -q "#abc12399" app/assets/builds/tailwind.css
7171

7272
echo "OK"

Diff for: test/integration/user_upgrade_test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ test -a postcss.config.js
8080

8181
# TEST: moving application.tailwind.css
8282
test ! -a app/assets/stylesheets/application.tailwind.css
83-
test -a app/assets/tailwind/application.tailwind.css
83+
test -a app/assets/tailwind/application.css
8484

8585
# generate CSS
8686
bin/rails tailwindcss:build[verbose]

0 commit comments

Comments
 (0)