diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c97ed..13daeb6 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 3cd46d7..320564c 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). @@ -262,12 +266,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 +317,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 99ad30e..9c910de 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 d176f2c..539a8df 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 d09481a..62d1e68 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)