From 1ea1314971899a88e8433861e5dc3918f2432f63 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 27 Oct 2025 17:03:27 -0400 Subject: [PATCH 1/2] Remove the "poll" option on the watch command which was never supported in Tailwind v4 (only v3). Closes #580 --- CHANGELOG.md | 5 +++++ README.md | 13 +++---------- lib/tailwindcss/commands.rb | 3 +-- lib/tasks/build.rake | 3 +-- test/lib/tailwindcss/commands_test.rb | 8 -------- 5 files changed, 10 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c97ed0..13daeb69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## next / unreleased +### Changed + +* Removed the "poll" option on the watch command, since Tailwind v4 dropped support for this option (and it has been a no-op in this gem since.) #580 @flavorjones + + ### Improved * Support Rails 8.1 scaffolding which disables system tests by default. #585 @flavorjones diff --git a/README.md b/README.md index 3cd46d7c..a1c2316d 100644 --- a/README.md +++ b/README.md @@ -262,12 +262,13 @@ Synopsis: - `bin/rails tailwindcss:install` - installs the configuration file, output file, and `Procfile.dev` - `bin/rails tailwindcss:build` - generate the output file - `bin/rails tailwindcss:build[debug]` - generate unminimized output + - `bin/rails tailwindcss:build[verbose]` - emit the commands being run - `bin/rails tailwindcss:watch` - start live rebuilds, generating output on file changes - `bin/rails tailwindcss:watch[debug]` - generate unminimized output - - `bin/rails tailwindcss:watch[poll]` - for systems without file system events - `bin/rails tailwindcss:watch[always]` - for systems without TTY (e.g., some docker containers) + - `bin/rails tailwindcss:watch[verbose]` - emit the commands being run -Note that you can combine task options, e.g. `rails tailwindcss:watch[debug,poll]`. +Note that you can combine task options, e.g. `rails tailwindcss:watch[debug,always]`. This gem also makes available a Puma plugin to manage a live rebuild process when you run `rails server` (see "Live Rebuild" section below). @@ -312,14 +313,6 @@ and then running `rails server` (or just `puma`) will run the Tailwind watch pro This is a flexible command, which can be run with a few different options. -If you are running `rails tailwindcss:watch` on a system that doesn't fully support file system events, pass a `poll` argument to the task to instruct tailwindcss to instead use polling: - -``` -rails tailwindcss:watch[poll] -``` - -(If you use `bin/dev` then you should modify your `Procfile.dev` to use the `poll` option.) - 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. 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`. diff --git a/lib/tailwindcss/commands.rb b/lib/tailwindcss/commands.rb index 99ad30e0..9c910de8 100644 --- a/lib/tailwindcss/commands.rb +++ b/lib/tailwindcss/commands.rb @@ -21,11 +21,10 @@ def compile_command(debug: false, **kwargs) command end - def watch_command(always: false, poll: false, **kwargs) + def watch_command(always: false, **kwargs) compile_command(**kwargs).tap do |command| command << "-w" command << "always" if always - command << "-p" if poll end end diff --git a/lib/tasks/build.rake b/lib/tasks/build.rake index d176f2cd..539a8df9 100644 --- a/lib/tasks/build.rake +++ b/lib/tasks/build.rake @@ -14,11 +14,10 @@ namespace :tailwindcss do desc "Watch and build your Tailwind CSS on file changes" task watch: [:environment, :engines] do |_, args| debug = args.extras.include?("debug") - poll = args.extras.include?("poll") always = args.extras.include?("always") verbose = args.extras.include?("verbose") - command = Tailwindcss::Commands.watch_command(always: always, debug: debug, poll: poll) + command = Tailwindcss::Commands.watch_command(always: always, debug: debug) env = Tailwindcss::Commands.command_env(verbose: verbose) puts "Running: #{Shellwords.join(command)}" if verbose diff --git a/test/lib/tailwindcss/commands_test.rb b/test/lib/tailwindcss/commands_test.rb index d09481a4..62d1e684 100644 --- a/test/lib/tailwindcss/commands_test.rb +++ b/test/lib/tailwindcss/commands_test.rb @@ -111,14 +111,6 @@ def setup refute_includes(actual, "-p") refute_includes(actual, "--minify") - actual = Tailwindcss::Commands.watch_command(poll: true) - assert_kind_of(Array, actual) - assert_equal(executable, actual.first) - assert_includes(actual, "-w") - refute_includes(actual, "always") - assert_includes(actual, "-p") - assert_includes(actual, "--minify") - actual = Tailwindcss::Commands.watch_command(always: true) assert_kind_of(Array, actual) assert_equal(executable, actual.first) From 5520c232deccf5ca946c4427e69f3a7d6be375a5 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 27 Oct 2025 17:04:06 -0400 Subject: [PATCH 2/2] doc: point to the v3 docs because we're continuing to remove documentation about v3 features --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a1c2316d..320564cd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # Tailwind CSS for Rails -[Tailwind CSS](https://tailwindcss.com) is a utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup. +[Tailwind CSS](https://tailwindcss.com) is a utility-first CSS framework packed with classes like `flex`, `pt-4`, `text-center` and `rotate-90` that can be composed to build any design, directly in your markup. + +> [!NOTE] +> This document is specific to Tailwind v4, corresponding to v4 of this gem. If you are looking for documentation for v3, please visit to the [tailwindcss-rails v3 +README](https://github.com/rails/tailwindcss-rails/tree/v3-stable?tab=readme-ov-file).