tailwindcss-rails 2.1.0-x86_64-linux → 2.2.1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -3
- data/exe/x86_64-linux/tailwindcss +0 -0
- data/lib/generators/tailwindcss/mailer/templates/layout.html.erb.tt +13 -0
- data/lib/generators/tailwindcss/mailer/templates/layout.text.erb.tt +1 -0
- data/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt +1 -1
- data/lib/install/Procfile.dev +1 -1
- data/lib/install/dev +8 -0
- data/lib/puma/plugin/tailwindcss.rb +63 -0
- data/lib/tailwindcss/upstream.rb +1 -1
- data/lib/tailwindcss/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c229e1a8d973f606179204d10edfd982dd74f8e12cd1b1ffe5acb943d7a5bf6
|
4
|
+
data.tar.gz: 40fd46f5fd7bcd54f17b99f07d29fb1a0c288d4133da325f782ef8bda55bf984
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a4ff6d5824bfd52111c56f3415a6645a5279cfb157b7907d9e99da54d0200b7df917a36664e19ae91025f976ff75cd2a454bc14d6cd82baa94ea1ffef4f9b94
|
7
|
+
data.tar.gz: 993ee186ed9075fbba8ec68d88da543ffecdd5e17cb11d2478f4adab50f64e8746933c6495f33e0b91903762978783887c8531649e55110cb7df90ec36de33ef
|
data/README.md
CHANGED
@@ -60,10 +60,26 @@ The `tailwindcss:build` task is automatically attached to the `test:prepare` Rak
|
|
60
60
|
|
61
61
|
### Update assets automatically
|
62
62
|
|
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
|
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:
|
64
64
|
|
65
|
-
-
|
66
|
-
-
|
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.
|
67
83
|
|
68
84
|
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`.
|
69
85
|
|
@@ -72,6 +88,11 @@ If you are running `rails tailwindcss:watch` as a process in a Docker container,
|
|
72
88
|
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`.
|
73
89
|
|
74
90
|
|
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
|
+
|
75
96
|
### Debugging with unminified assets
|
76
97
|
|
77
98
|
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,6 +192,12 @@ The inline version also works:
|
|
171
192
|
<section class="bg-[url('image.svg')]">Has the image as it's background</section>
|
172
193
|
```
|
173
194
|
|
195
|
+
### Conflict with pre-existing asset pipeline stylesheets
|
196
|
+
|
197
|
+
If you get a warning `Unrecognized at-rule or error parsing at-rule ‘@tailwind’.` in the browser console after installation, you incorrectly double-process `application.tailwind.css`. This is a misconfiguration, even though the styles will be fully effective in many cases. The file `application.tailwind.css` is installed when running `rails tailwindcss:install` and is placed alongside the common `application.css` in `app/assets/stylesheets`. Because the `application.css` in a newly generated Rails app includes a `require_tree .` directive, the asset pipeline incorrectly processes `application.tailwind.css`, where it should be taken care of by `tailwindcss`. The asset pipeline ignores TailwindCSS's at-directives, and the browser can't process them.
|
198
|
+
|
199
|
+
To fix the warning, you can either remove the `application.css`, if you don't plan to use the asset pipeline for stylesheets, and instead rely on TailwindCSS completely for styles. This is what this installer assumes. Else, if you do want to keep using the asset pipeline in parallel, make sure to remove the `require_tree .` line from the `application.css`.
|
200
|
+
|
174
201
|
## License
|
175
202
|
|
176
203
|
Tailwind for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<%%= yield %>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<div class="my-5">
|
16
16
|
<% if attribute.password_digest? -%>
|
17
17
|
<%%= form.label :password %>
|
18
|
-
<%%= form.password_field :password %>
|
18
|
+
<%%= form.password_field :password, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
|
19
19
|
</div>
|
20
20
|
|
21
21
|
<div class="my-5">
|
data/lib/install/Procfile.dev
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
web:
|
1
|
+
web: bin/rails server
|
2
2
|
css: bin/rails tailwindcss:watch
|
data/lib/install/dev
CHANGED
@@ -5,4 +5,12 @@ if ! gem list foreman -i --silent; then
|
|
5
5
|
gem install foreman
|
6
6
|
fi
|
7
7
|
|
8
|
+
# Default to port 3000 if not specified
|
9
|
+
export PORT="${PORT:-3000}"
|
10
|
+
|
11
|
+
# Let the debug gem allow remote connections,
|
12
|
+
# but avoid loading until `debugger` is called
|
13
|
+
export RUBY_DEBUG_OPEN="true"
|
14
|
+
export RUBY_DEBUG_LAZY="true"
|
15
|
+
|
8
16
|
exec foreman start -f Procfile.dev "$@"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require "puma/plugin"
|
2
|
+
|
3
|
+
Puma::Plugin.create do
|
4
|
+
attr_reader :puma_pid, :tailwind_pid, :log_writer
|
5
|
+
|
6
|
+
def start(launcher)
|
7
|
+
@log_writer = launcher.log_writer
|
8
|
+
@puma_pid = $$
|
9
|
+
@tailwind_pid = fork do
|
10
|
+
Thread.new { monitor_puma }
|
11
|
+
system(*Tailwindcss::Commands.watch_command)
|
12
|
+
end
|
13
|
+
|
14
|
+
launcher.events.on_stopped { stop_tailwind }
|
15
|
+
|
16
|
+
in_background do
|
17
|
+
monitor_tailwind
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def stop_tailwind
|
23
|
+
Process.waitpid(tailwind_pid, Process::WNOHANG)
|
24
|
+
log "Stopping tailwind..."
|
25
|
+
Process.kill(:INT, tailwind_pid) if tailwind_pid
|
26
|
+
Process.wait(tailwind_pid)
|
27
|
+
rescue Errno::ECHILD, Errno::ESRCH
|
28
|
+
end
|
29
|
+
|
30
|
+
def monitor_puma
|
31
|
+
monitor(:puma_dead?, "Detected Puma has gone away, stopping tailwind...")
|
32
|
+
end
|
33
|
+
|
34
|
+
def monitor_tailwind
|
35
|
+
monitor(:tailwind_dead?, "Detected tailwind has gone away, stopping Puma...")
|
36
|
+
end
|
37
|
+
|
38
|
+
def monitor(process_dead, message)
|
39
|
+
loop do
|
40
|
+
if send(process_dead)
|
41
|
+
log message
|
42
|
+
Process.kill(:INT, $$)
|
43
|
+
break
|
44
|
+
end
|
45
|
+
sleep 2
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def tailwind_dead?
|
50
|
+
Process.waitpid(tailwind_pid, Process::WNOHANG)
|
51
|
+
false
|
52
|
+
rescue Errno::ECHILD, Errno::ESRCH
|
53
|
+
true
|
54
|
+
end
|
55
|
+
|
56
|
+
def puma_dead?
|
57
|
+
Process.ppid != puma_pid
|
58
|
+
end
|
59
|
+
|
60
|
+
def log(...)
|
61
|
+
log_writer.log(...)
|
62
|
+
end
|
63
|
+
end
|
data/lib/tailwindcss/upstream.rb
CHANGED
data/lib/tailwindcss/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailwindcss-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -58,6 +58,8 @@ files:
|
|
58
58
|
- lib/generators/tailwindcss/controller/controller_generator.rb
|
59
59
|
- lib/generators/tailwindcss/controller/templates/view.html.erb.tt
|
60
60
|
- lib/generators/tailwindcss/mailer/mailer_generator.rb
|
61
|
+
- lib/generators/tailwindcss/mailer/templates/layout.html.erb.tt
|
62
|
+
- lib/generators/tailwindcss/mailer/templates/layout.text.erb.tt
|
61
63
|
- lib/generators/tailwindcss/mailer/templates/view.html.erb.tt
|
62
64
|
- lib/generators/tailwindcss/mailer/templates/view.text.erb.tt
|
63
65
|
- lib/generators/tailwindcss/scaffold/scaffold_generator.rb
|
@@ -72,6 +74,7 @@ files:
|
|
72
74
|
- lib/install/dev
|
73
75
|
- lib/install/tailwind.config.js
|
74
76
|
- lib/install/tailwindcss.rb
|
77
|
+
- lib/puma/plugin/tailwindcss.rb
|
75
78
|
- lib/tailwindcss-rails.rb
|
76
79
|
- lib/tailwindcss/commands.rb
|
77
80
|
- lib/tailwindcss/engine.rb
|