tailwindcss-rails 4.0.0.rc2 → 4.0.0.rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +66 -20
- data/lib/install/install_tailwindcss.rb +4 -4
- data/lib/install/upgrade_tailwindcss.rb +6 -6
- data/lib/tailwindcss/commands.rb +1 -1
- data/lib/tailwindcss/engine.rb +1 -1
- data/lib/tailwindcss/version.rb +1 -1
- metadata +3 -19
- data/app/assets/fonts/Inter-italic.alternates.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.cyrillic.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.extra.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.greek.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.latin-ext.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.latin.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.symbols.var.woff2 +0 -0
- data/app/assets/fonts/Inter-italic.vietnamese.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.alternates.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.cyrillic.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.extra.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.greek.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.latin-ext.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.latin.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.symbols.var.woff2 +0 -0
- data/app/assets/fonts/Inter-roman.vietnamese.var.woff2 +0 -0
- /data/lib/install/{application.tailwind.css → application.css} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12604797b6ffc0e9448b859c4b25511065fc86dd28c1479d9a48186ac7b2cfd1
|
4
|
+
data.tar.gz: b908633069e894863319afa7f3ea64737e47e906d17f257e02763548cca1d2c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f95003629c04627ceef411f2def2cb09d4a7f3d9452d5be2ed1871d8912f7ceb16a3db49948f444e5c2d67d1cf8dac3ccca17425eb7b15b2cd2395acd4ab61ce
|
7
|
+
data.tar.gz: c2f5deca8a2eb716ed9d006d318268640e5f83894302111eeb648afdd861834ad732dfc387ad0985eabecf4570b35f68e8b77871399c8fb293da499861e7e533
|
data/README.md
CHANGED
@@ -12,8 +12,8 @@
|
|
12
12
|
- [Upgrading your application from Tailwind v3 to v4](#upgrading-your-application-from-tailwind-v3-to-v4)
|
13
13
|
* [You don't _have_ to upgrade](#you-dont-_have_-to-upgrade)
|
14
14
|
* [Upgrade steps](#upgrade-steps)
|
15
|
-
* [Plugins](#plugins)
|
16
15
|
* [Troubleshooting](#troubleshooting)
|
16
|
+
* [Updating CSS class names for v4](#updating-css-class-names-for-v4)
|
17
17
|
- [Developing with Tailwindcss](#developing-with-tailwindcss)
|
18
18
|
* [Configuration and commands](#configuration-and-commands)
|
19
19
|
* [Building for production](#building-for-production)
|
@@ -92,18 +92,47 @@ gem "tailwindcss-ruby", "~> 3.4"
|
|
92
92
|
|
93
93
|
First, update to `tailwindcss-rails` v4.0.0 or higher. This will also ensure you're transitively depending on `tailwindcss-ruby` v4.
|
94
94
|
|
95
|
-
|
95
|
+
|
96
|
+
```html
|
96
97
|
# Gemfile
|
97
98
|
gem "tailwindcss-rails", "~> 4.0" # which transitively pins tailwindcss-ruby to v4
|
98
99
|
```
|
99
100
|
|
100
|
-
|
101
|
+
If you want to migrate class names for v4 (optional), apply this [step](#upgrading-class-names-for-v4) and continue this guide.
|
102
|
+
|
103
|
+
Add the following line to the `.gitignore` file:
|
104
|
+
|
105
|
+
```gitignore
|
106
|
+
/node_modules
|
107
|
+
```
|
108
|
+
(So the Tailwind update tool won’t dig through your node_modules files and infer incorrect migrations, because it complies with ``.gitignore`` constraints)
|
109
|
+
|
110
|
+
Then create a ``package.json`` in the root of the project:
|
111
|
+
|
112
|
+
```jsonc
|
113
|
+
{
|
114
|
+
"name": "app_name",
|
115
|
+
"version": "1.0.0",
|
116
|
+
"dependencies": {
|
117
|
+
"tailwindcss": "^3.4.17", // Mandatory!!
|
118
|
+
// Install all plugins and modules that are referenced in tailwind.config.js
|
119
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
120
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
121
|
+
"@tailwindcss/forms": "^0.5.10",
|
122
|
+
"@tailwindcss/typography": "^0.5.16"
|
123
|
+
// And so on...
|
124
|
+
}
|
125
|
+
}
|
126
|
+
```
|
127
|
+
**Run** ``npm install`` (or ``yarn install`` if using ``yarn``)
|
128
|
+
|
129
|
+
Then, **run** the `tailwindcss:upgrade` task. Among other things, this will try to run the official Tailwind upgrade utility. It requires `npx` in order to run, but it's a one-time operation and is *highly recommended* for a successful upgrade.
|
101
130
|
|
102
131
|
Here's what the upgrade task does:
|
103
132
|
|
104
133
|
- Cleans up some things in the generated `config/tailwind.config.js`.
|
105
134
|
- If present, moves `config/postcss.config.js` to the root directory.
|
106
|
-
- If present, moves `app/assets/stylesheets/application.tailwind.css` to `app/assets/tailwind`.
|
135
|
+
- If present, moves `app/assets/stylesheets/application.tailwind.css` to `app/assets/tailwind/application.css`.
|
107
136
|
- Removes unnecessary `stylesheet_link_tag "tailwindcss"` tags from the application layout.
|
108
137
|
- Removes references to the Inter font from the application layout.
|
109
138
|
- Runs the upstream upgrader (note: requires `npx` to run the one-time upgrade, but highly recommended).
|
@@ -120,22 +149,22 @@ $ bin/rails tailwindcss:upgrade
|
|
120
149
|
gsub app/views/layouts/application.html.erb
|
121
150
|
Remove unnecessary stylesheet_link_tag from application layout
|
122
151
|
gsub app/views/layouts/application.html.erb
|
123
|
-
Moving application.tailwind.css to /home/user/myapp/app/assets/tailwind
|
124
|
-
create app/assets/tailwind/application.
|
152
|
+
Moving /home/user/myapp/app/assets/stylesheets/application.tailwind.css to /home/user/myapp/app/assets/tailwind/application.css
|
153
|
+
create app/assets/tailwind/application.css
|
125
154
|
remove app/assets/stylesheets/application.tailwind.css
|
126
155
|
10.9.0
|
127
156
|
Running the upstream Tailwind CSS upgrader
|
128
157
|
run npx @tailwindcss/upgrade@next --force --config /home/user/myapp/config/tailwind.config.js from "."
|
129
158
|
≈ tailwindcss v4.0.0
|
130
159
|
│ Searching for CSS files in the current directory and its subdirectories…
|
131
|
-
│ ↳ Linked `./config/tailwind.config.js` to `./app/assets/tailwind/application.
|
160
|
+
│ ↳ Linked `./config/tailwind.config.js` to `./app/assets/tailwind/application.css`
|
132
161
|
│ Migrating JavaScript configuration files…
|
133
162
|
│ ↳ The configuration file at `./config/tailwind.config.js` could not be automatically migrated to the new CSS
|
134
163
|
│ configuration format, so your CSS has been updated to load your existing configuration file.
|
135
164
|
│ Migrating templates…
|
136
165
|
│ ↳ Migrated templates for configuration file: `./config/tailwind.config.js`
|
137
166
|
│ Migrating stylesheets…
|
138
|
-
│ ↳ Migrated stylesheet: `./app/assets/tailwind/application.
|
167
|
+
│ ↳ Migrated stylesheet: `./app/assets/tailwind/application.css`
|
139
168
|
│ ↳ No PostCSS config found, skipping migration.
|
140
169
|
│ Updating dependencies…
|
141
170
|
│ Could not detect a package manager. Please manually update `tailwindcss` to v4.
|
@@ -146,17 +175,10 @@ $ bin/rails tailwindcss:upgrade
|
|
146
175
|
Done in 56ms
|
147
176
|
run bundle install --quiet
|
148
177
|
```
|
149
|
-
|
150
178
|
</details>
|
151
179
|
|
152
|
-
If this doesn't succeed, it's likely that you've customized your Tailwind configuration and you'll need to do some work to make sure your application upgrades. Please read the [official upgrade guide](https://tailwindcss.com/docs/upgrade-guide)!
|
153
|
-
|
154
|
-
|
155
|
-
### Plugins
|
156
|
-
|
157
|
-
In Tailwind CLI v3, some Tailwind plugins were included by default in the CLI tool. However, in v4 these default plugins have been removed.
|
158
180
|
|
159
|
-
|
181
|
+
If this doesn't succeed, it's likely that you've customized your Tailwind configuration and you'll need to do some work to make sure your application upgrades. Please read the [official upgrade guide](https://tailwindcss.com/docs/upgrade-guide)!
|
160
182
|
|
161
183
|
|
162
184
|
### Troubleshooting
|
@@ -165,21 +187,45 @@ You may want to check out [TailwindCSS v4 - upgrade experience report · rails/t
|
|
165
187
|
|
166
188
|
We know there are some cases we haven't addressed with the upgrade task:
|
167
189
|
|
168
|
-
- If the user isn’t using PostCSS, some migrations (e.g., updating class names in the view files) may fail
|
169
190
|
- In setups without JavaScript tooling, the update process may fail to fully migrate `tailwind.config.js` because the tool assumes that the imported packages (e.g., tailwind plugins) are installed via a package manager, allowing them to be called.
|
170
191
|
|
171
192
|
We'll try to improve the upgrade process over time, but for now you may need to do some manual work to upgrade.
|
172
193
|
|
173
194
|
|
195
|
+
### Updating CSS class names for v4
|
196
|
+
|
197
|
+
Before running the upgrade task, go to ``config/tailwind.config.js`` update the ``content`` part to:
|
198
|
+
|
199
|
+
```js
|
200
|
+
content: [
|
201
|
+
'../public/*.html',
|
202
|
+
'../app/helpers/**/*.rb',
|
203
|
+
'../app/javascript/**/*.js',
|
204
|
+
'../app/views/**/*.{erb,haml,html,slim}'
|
205
|
+
],
|
206
|
+
```
|
207
|
+
(Just add an additional ``.`` to all the paths referenced)
|
208
|
+
|
209
|
+
Run the upstream upgrader as instructed above.
|
210
|
+
|
211
|
+
Then, once you've run that successfully:
|
212
|
+
|
213
|
+
- **Delete** ``package.json``, ``node_modules/`` and ``package-lock.json`` (or ``yarn.lock``), plus remove ``/node_modules`` from ``.gitignore``.
|
214
|
+
- **Go** to your CSS file and remove the following line (if present):
|
215
|
+
```css
|
216
|
+
@plugin '@tailwindcss/container-queries';
|
217
|
+
```
|
218
|
+
|
219
|
+
|
174
220
|
## Developing with Tailwindcss
|
175
221
|
|
176
222
|
### Configuration and commands
|
177
223
|
|
178
|
-
#### Input file: `app/assets/tailwind/application.
|
224
|
+
#### Input file: `app/assets/tailwind/application.css`
|
179
225
|
|
180
|
-
The `tailwindcss:install` task will generate a Tailwind input file in `app/assets/tailwind/application.
|
226
|
+
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.
|
181
227
|
|
182
|
-
⚠ 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.
|
228
|
+
⚠ 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.
|
183
229
|
|
184
230
|
#### Output file: `app/assets/builds/tailwind.css`
|
185
231
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
|
2
2
|
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")
|
4
4
|
|
5
5
|
if APPLICATION_LAYOUT_PATH.exist?
|
6
6
|
unless File.read(APPLICATION_LAYOUT_PATH).match?(/stylesheet_link_tag :app/)
|
@@ -32,9 +32,9 @@ if Rails.root.join(".gitignore").exist?
|
|
32
32
|
append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
|
33
33
|
end
|
34
34
|
|
35
|
-
unless TAILWIND_ASSET_PATH.
|
36
|
-
say "Add default #{TAILWIND_ASSET_PATH}
|
37
|
-
copy_file "#{__dir__}/application.
|
35
|
+
unless TAILWIND_ASSET_PATH.exist?
|
36
|
+
say "Add default #{TAILWIND_ASSET_PATH}"
|
37
|
+
copy_file "#{__dir__}/application.css", TAILWIND_ASSET_PATH
|
38
38
|
end
|
39
39
|
|
40
40
|
if Rails.root.join("Procfile.dev").exist?
|
@@ -1,8 +1,8 @@
|
|
1
1
|
TAILWIND_CONFIG_PATH = Rails.root.join("config/tailwind.config.js")
|
2
2
|
APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
|
3
3
|
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")
|
6
6
|
|
7
7
|
unless TAILWIND_CONFIG_PATH.exist?
|
8
8
|
say "Default tailwind.config.js is missing!", :red
|
@@ -38,10 +38,10 @@ else
|
|
38
38
|
say %( Please check your layouts and remove any "inter-font" stylesheet links.)
|
39
39
|
end
|
40
40
|
|
41
|
-
if OLD_TAILWIND_ASSET_PATH.
|
42
|
-
say "Moving
|
43
|
-
copy_file OLD_TAILWIND_ASSET_PATH
|
44
|
-
remove_file OLD_TAILWIND_ASSET_PATH
|
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
|
45
45
|
end
|
46
46
|
|
47
47
|
if system("npx --version")
|
data/lib/tailwindcss/commands.rb
CHANGED
@@ -8,7 +8,7 @@ module Tailwindcss
|
|
8
8
|
|
9
9
|
command = [
|
10
10
|
Tailwindcss::Ruby.executable(**kwargs),
|
11
|
-
"-i", rails_root.join("app/assets/tailwind/application.
|
11
|
+
"-i", rails_root.join("app/assets/tailwind/application.css").to_s,
|
12
12
|
"-o", rails_root.join("app/assets/builds/tailwind.css").to_s,
|
13
13
|
]
|
14
14
|
|
data/lib/tailwindcss/engine.rb
CHANGED
@@ -6,7 +6,7 @@ module Tailwindcss
|
|
6
6
|
Rails.application.config.generators.stylesheets = false
|
7
7
|
end
|
8
8
|
|
9
|
-
initializer "tailwindcss.exclude_asset_path",
|
9
|
+
initializer "tailwindcss.exclude_asset_path", before: "propshaft.append_assets_path" do
|
10
10
|
if Rails.application.config.assets.excluded_paths # the app may not be using Propshaft
|
11
11
|
Rails.application.config.assets.excluded_paths << Rails.root.join("app/assets/tailwind")
|
12
12
|
end
|
data/lib/tailwindcss/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailwindcss-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-27 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: railties
|
@@ -45,22 +45,6 @@ files:
|
|
45
45
|
- MIT-LICENSE
|
46
46
|
- README.md
|
47
47
|
- Rakefile
|
48
|
-
- app/assets/fonts/Inter-italic.alternates.var.woff2
|
49
|
-
- app/assets/fonts/Inter-italic.cyrillic.var.woff2
|
50
|
-
- app/assets/fonts/Inter-italic.extra.var.woff2
|
51
|
-
- app/assets/fonts/Inter-italic.greek.var.woff2
|
52
|
-
- app/assets/fonts/Inter-italic.latin-ext.var.woff2
|
53
|
-
- app/assets/fonts/Inter-italic.latin.var.woff2
|
54
|
-
- app/assets/fonts/Inter-italic.symbols.var.woff2
|
55
|
-
- app/assets/fonts/Inter-italic.vietnamese.var.woff2
|
56
|
-
- app/assets/fonts/Inter-roman.alternates.var.woff2
|
57
|
-
- app/assets/fonts/Inter-roman.cyrillic.var.woff2
|
58
|
-
- app/assets/fonts/Inter-roman.extra.var.woff2
|
59
|
-
- app/assets/fonts/Inter-roman.greek.var.woff2
|
60
|
-
- app/assets/fonts/Inter-roman.latin-ext.var.woff2
|
61
|
-
- app/assets/fonts/Inter-roman.latin.var.woff2
|
62
|
-
- app/assets/fonts/Inter-roman.symbols.var.woff2
|
63
|
-
- app/assets/fonts/Inter-roman.vietnamese.var.woff2
|
64
48
|
- lib/generators/tailwindcss/authentication/authentication_generator.rb
|
65
49
|
- lib/generators/tailwindcss/authentication/templates/app/views/passwords/edit.html.erb
|
66
50
|
- lib/generators/tailwindcss/authentication/templates/app/views/passwords/new.html.erb
|
@@ -80,7 +64,7 @@ files:
|
|
80
64
|
- lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt
|
81
65
|
- lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt
|
82
66
|
- lib/install/Procfile.dev
|
83
|
-
- lib/install/application.
|
67
|
+
- lib/install/application.css
|
84
68
|
- lib/install/dev
|
85
69
|
- lib/install/install_tailwindcss.rb
|
86
70
|
- lib/install/upgrade_tailwindcss.rb
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|