tailwindcss-rails 4.2.1 → 4.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cde0f5138ce94e7f0950609937b8b587544fbe6bf20ef99832a06b2f281594a9
4
- data.tar.gz: 5310351386db63343b7071bdef2e2b41576e9263e1bf10fb16ba9720f0711ea6
3
+ metadata.gz: 4f9432f8ea93e9b2a5ad5a393724d7700719e308ca529d2e699020b4b2e4a772
4
+ data.tar.gz: '087b41c460af3f8f2b00cbb8e784791570926012fa154208f4ee5c2e19bc9ac9'
5
5
  SHA512:
6
- metadata.gz: 864d2d89ffd939532d267041cdf5dcf47fa835148631fd9104227a23d2cc1823a1285cd265d06f2819d8da7bec92347b6116a00cc1e372425c5175a67cfe9bee
7
- data.tar.gz: c34e1c243f687fa334c4915284faf634f5e7492d87fc87809a37002febf2bd3d10a785d01eae26b5801c1ec63e97625d4ebb72dfee410bec6676dd210730b436
6
+ metadata.gz: 7989b142725276b80467e9c1009f086fee96581aab1022d609c5bfd5cab47ab9bee610ba2827996f67f156c9e73cec1b0e05cae7b8571e85a33fcebf4202734d
7
+ data.tar.gz: 46ac09b2e9f6cfc7b273746212f4a71af5cbd6be3eb05332938119150f62f0c91fac6a0ce4553ebf2fa722e4ee891d5471c0c561ee758d1a2bfbc6e0511bc9e7
data/README.md CHANGED
@@ -145,7 +145,7 @@ $ bin/rails tailwindcss:upgrade
145
145
  remove app/assets/stylesheets/application.tailwind.css
146
146
  10.9.0
147
147
  Running the upstream Tailwind CSS upgrader
148
- run npx @tailwindcss/upgrade@next --force --config /home/user/myapp/config/tailwind.config.js from "."
148
+ run npx @tailwindcss/upgrade --force --config /home/user/myapp/config/tailwind.config.js from "."
149
149
  ≈ tailwindcss v4.0.0
150
150
  │ Searching for CSS files in the current directory and its subdirectories…
151
151
  │ ↳ Linked `./config/tailwind.config.js` to `./app/assets/tailwind/application.css`
@@ -403,30 +403,63 @@ If you need to use a custom input or output file, you can run `bundle exec tailw
403
403
 
404
404
  ## Troubleshooting
405
405
 
406
- Some common problems experienced by users ...
406
+ When having trouble with `tailwindcss:build` or `tailwindcss:watch`, the first thing you should do is collect some diagnostic information by setting the "verbose" flag, which will emit:
407
+
408
+ 1. the command being run (so you can try running `tailwindcss` yourself without the gem's help)
409
+ 2. additional debugging output from `tailwindcss` by setting the env var `DEBUG=1`
410
+
411
+ Here's what that looks like:
412
+
413
+ ``` sh
414
+ $ bin/rails tailwindcss:build[verbose]
415
+
416
+ Running: /path/to/tailwindcss-ruby-4.0.17-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss -i /home/flavorjones/code/oss/tailwindcss-rails/My Workspace/test-install/app/assets/tailwind/application.css -o /home/flavorjones/code/oss/tailwindcss-rails/My Workspace/test-install/app/assets/builds/tailwind.css --minify
417
+ ≈ tailwindcss v4.0.17
418
+
419
+ Done in 37ms
420
+
421
+ [38.22ms] [@tailwindcss/cli] (initial build)
422
+ [11.90ms] ↳ Setup compiler
423
+ [ 6.52ms] ↳ Scan for candidates
424
+ [10.39ms] ↳ Build CSS
425
+ [ 1.69ms] ↳ Optimize CSS
426
+ [ 5.80ms] ↳ Write output
427
+ ```
428
+
429
+ ### The `watch` command is hanging
430
+
431
+ There is a [known issue](https://github.com/tailwindlabs/tailwindcss/issues/17246#issuecomment-2753067488) running `tailwindcss -w` (that's the CLI in watch mode) when the utility `watchman` is also installed.
432
+
433
+ Please try uninstalling `watchman` and try running the watch task again.
434
+
407
435
 
408
436
  ### Lost keystrokes or hanging when using terminal-based debugging tools (e.g. IRB, Pry, `ruby/debug`...etc.) with the Puma plugin
409
437
 
410
438
  We've addressed the issue and you can avoid the problem by upgrading `tailwindcss-rails` to [v2.4.1](https://github.com/rails/tailwindcss-rails/releases/tag/v2.4.1) or later versions.
411
439
 
440
+
412
441
  ### Running in a docker container exits prematurely
413
442
 
414
443
  If you are running `rails tailwindcss:watch` as a process in a Docker container, set `tty: true` in `docker-compose.yml` for the appropriate container to keep the watch process running.
415
444
 
416
445
  If you are running `rails tailwindcss:watch` in a docker container without a tty, pass the `always` argument to the task to instruct tailwindcss to keep the watcher alive even when `stdin` is closed: `rails tailwindcss:watch[always]`. If you use `bin/dev` then you should modify your `Procfile.dev`.
417
446
 
447
+
418
448
  ### Conflict with sassc-rails
419
449
 
420
450
  Tailwind uses modern CSS features that are not recognized by the `sassc-rails` extension that was included by default in the Gemfile for Rails 6. In order to avoid any errors like `SassC::SyntaxError`, you must remove that gem from your Gemfile.
421
451
 
452
+
422
453
  ### Class names must be spelled out
423
454
 
424
455
  For Tailwind to work, your class names need to be spelled out. If you need to make sure Tailwind generates class names that don't exist in your content files or that are programmatically composed, use the [safelist option](https://tailwindcss.com/docs/content-configuration#safelisting-classes).
425
456
 
457
+
426
458
  ### `ERROR: Cannot find the tailwindcss executable` for supported platform
427
459
 
428
460
  See https://github.com/flavorjones/tailwindcss-ruby for help.
429
461
 
462
+
430
463
  ### Using asset-pipeline assets
431
464
 
432
465
  In Rails, you want to use [assets from the asset pipeline to get fingerprinting](https://guides.rubyonrails.org/asset_pipeline.html#fingerprinting-versioning-with-digest-based-urls). However, Tailwind isn't aware of those assets.
@@ -18,9 +18,7 @@
18
18
  <div class="w-full sm:w-auto flex flex-col sm:flex-row space-x-2 space-y-2">
19
19
  <%%= link_to "Show", <%= model_resource_name(singular_table_name) %>, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
20
20
  <%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
21
- <div class="sm:inline-block">
22
- <%%= button_to "Destroy", <%= model_resource_name %>, method: :delete, class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
23
- </div>
21
+ <%%= button_to "Destroy", <%= model_resource_name %>, method: :delete, class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
24
22
  </div>
25
23
  </div>
26
24
  <%% end %>
@@ -11,7 +11,5 @@
11
11
 
12
12
  <%%= link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %>, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
13
13
  <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
14
- <div class="sm:inline-block mt-2 sm:mt-0 sm:ml-2">
15
- <%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, class: "w-full rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
16
- </div>
14
+ <%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, form_class: "sm:inline-block mt-2 sm:mt-0 sm:ml-2", class: "w-full rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
17
15
  </div>
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  if system("npx --version")
48
48
  say "Running the upstream Tailwind CSS upgrader"
49
- command = Shellwords.join(["npx", "@tailwindcss/upgrade@next", "--force", "--config", TAILWIND_CONFIG_PATH.to_s])
49
+ command = Shellwords.join(["npx", "@tailwindcss/upgrade", "--force", "--config", TAILWIND_CONFIG_PATH.to_s])
50
50
  success = run(command, abort_on_failure: false)
51
51
  unless success
52
52
  say "The upgrade tool failed!", :red
@@ -29,6 +29,12 @@ module Tailwindcss
29
29
  end
30
30
  end
31
31
 
32
+ def command_env(verbose:)
33
+ {}.tap do |env|
34
+ env["DEBUG"] = "1" if verbose
35
+ end
36
+ end
37
+
32
38
  def rails_css_compressor?
33
39
  defined?(Rails) && Rails&.application&.config&.assets&.css_compressor.present?
34
40
  end
@@ -1,3 +1,3 @@
1
1
  module Tailwindcss
2
- VERSION = "4.2.1"
2
+ VERSION = "4.2.2"
3
3
  end
data/lib/tasks/build.rake CHANGED
@@ -2,9 +2,13 @@ namespace :tailwindcss do
2
2
  desc "Build your Tailwind CSS"
3
3
  task build: :environment do |_, args|
4
4
  debug = args.extras.include?("debug")
5
+ verbose = args.extras.include?("verbose")
6
+
5
7
  command = Tailwindcss::Commands.compile_command(debug: debug)
6
- puts command.inspect if args.extras.include?("verbose")
7
- system(*command, exception: true)
8
+ env = Tailwindcss::Commands.command_env(verbose: verbose)
9
+ puts "Running: #{Shellwords.join(command)}" if verbose
10
+
11
+ system(env, *command, exception: true)
8
12
  end
9
13
 
10
14
  desc "Watch and build your Tailwind CSS on file changes"
@@ -12,9 +16,13 @@ namespace :tailwindcss do
12
16
  debug = args.extras.include?("debug")
13
17
  poll = args.extras.include?("poll")
14
18
  always = args.extras.include?("always")
19
+ verbose = args.extras.include?("verbose")
20
+
15
21
  command = Tailwindcss::Commands.watch_command(always: always, debug: debug, poll: poll)
16
- puts command.inspect if args.extras.include?("verbose")
17
- system(*command)
22
+ env = Tailwindcss::Commands.command_env(verbose: verbose)
23
+ puts "Running: #{Shellwords.join(command)}" if verbose
24
+
25
+ system(env, *command)
18
26
  rescue Interrupt
19
27
  puts "Received interrupt, exiting tailwindcss:watch" if args.extras.include?("verbose")
20
28
  end
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.2.1
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-19 00:00:00.000000000 Z
10
+ date: 2025-04-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: railties