Skip to content

Commit eb45dcd

Browse files
committed
doc: rework README to feature the Puma plugin
1 parent cf872d6 commit eb45dcd

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

README.md

+24-10
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,26 @@ The `tailwindcss:build` task is automatically attached to the `test:prepare` Rak
6060

6161
### Update assets automatically
6262

63-
While you're developing your application, you want to run Tailwind in "watch" mode, so changes are automatically reflected in the generated CSS output. You can do this by:
63+
While you're developing your application, you want to run Tailwind in "watch" mode, so changes are automatically reflected in the generated CSS output. You can do this in a few different ways:
6464

65-
- running `rails tailwindcss:watch` as a separate process,
66-
- or by running `./bin/dev` which uses [foreman](https://github.com/ddollar/foreman) to start both the Tailwind watch process and the rails server in development mode.
65+
- use the [Puma](https://puma.io/) plugin to integrate "watch" with `rails server`, or
66+
- run `rails tailwindcss:watch` as a separate process, or
67+
- run `bin/dev` which uses [Foreman](https://github.com/ddollar/foreman)
68+
69+
#### Puma plugin
70+
71+
The Puma plugin requires you to add this line to your `puma.rb` configuration:
72+
73+
```ruby
74+
plugin :tailwindcss if ENV.fetch("RAILS_ENV", "development") == "development"
75+
```
76+
77+
and then running `rails server` will run the Tailwind watch process in the background
78+
79+
80+
#### Run `rails tailwindcss:watch`
81+
82+
This is a flexible command, which can be run with a few different options.
6783

6884
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`.
6985

@@ -72,6 +88,11 @@ If you are running `rails tailwindcss:watch` as a process in a Docker container,
7288
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`.
7389

7490

91+
#### Foreman
92+
93+
Running `bin/dev` invokes Foreman to start both the Tailwind watch process and the rails server in development mode based on your `Procfile.dev` file.
94+
95+
7596
### Debugging with unminified assets
7697

7798
If you want unminified assets, you can pass a `debug` argument to the rake task, i.e. `rails tailwindcss:build[debug]` or `rails tailwindcss:watch[debug]`.
@@ -171,13 +192,6 @@ The inline version also works:
171192
<section class="bg-[url('image.svg')]">Has the image as it's background</section>
172193
```
173194

174-
## Puma plugin
175-
We provide a Puma plugin if you want to run the Tailwind watcher together with Puma and have Puma monitor and manage it. Add
176-
```ruby
177-
plugin :tailwindcss if ENV.fetch("RAILS_ENV", "development") == "development"
178-
```
179-
to your `puma.rb` configuration.
180-
181195
## License
182196

183197
Tailwind for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)