tailwindcss-rails 4.4.0 → 4.6.0
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 +4 -4
- data/README.md +2 -0
- data/lib/tailwindcss/commands.rb +2 -1
- data/lib/tailwindcss/process_runner.rb +59 -0
- data/lib/tailwindcss/version.rb +1 -1
- data/lib/tailwindcss-rails.rb +1 -0
- data/lib/tasks/build.rake +6 -5
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f267a171a6a28b6a5f433e4957f72f4edf6c027cfd386c3aa1ed96fc6a2eb6f6
|
|
4
|
+
data.tar.gz: 025b01f752fafb76b48717d2ce07b03bd23fed1106a4ca2dafe2bea850538341
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d04850588508ebf0adc736879845b1cb8d6f992768487ed9274f752388183280860d75640096953a2dc1dbac9be32730962ccd9292c04487692baecbe8d5c1ed
|
|
7
|
+
data.tar.gz: 8b008e2b24fcfd5e238155ae456ca1249c3d7767fa6b96db34349173493291dfcdce20dffc3d97799322c6669f77b77bfd3a52723a3d72de9f940b1c6a690678
|
data/README.md
CHANGED
|
@@ -266,10 +266,12 @@ Synopsis:
|
|
|
266
266
|
- `bin/rails tailwindcss:install` - installs the configuration file, output file, and `Procfile.dev`
|
|
267
267
|
- `bin/rails tailwindcss:build` - generate the output file
|
|
268
268
|
- `bin/rails tailwindcss:build[debug]` - generate unminimized output
|
|
269
|
+
- `bin/rails tailwindcss:build[silent]` - suppress non-error output from tailwindcss (requires Tailwind CSS v4.3.1)
|
|
269
270
|
- `bin/rails tailwindcss:build[verbose]` - emit the commands being run
|
|
270
271
|
- `bin/rails tailwindcss:watch` - start live rebuilds, generating output on file changes
|
|
271
272
|
- `bin/rails tailwindcss:watch[debug]` - generate unminimized output
|
|
272
273
|
- `bin/rails tailwindcss:watch[always]` - for systems without TTY (e.g., some docker containers)
|
|
274
|
+
- `bin/rails tailwindcss:watch[silent]` - suppress non-error output from tailwindcss (requires Tailwind CSS v4.3.1)
|
|
273
275
|
- `bin/rails tailwindcss:watch[verbose]` - emit the commands being run
|
|
274
276
|
|
|
275
277
|
Note that you can combine task options, e.g. `rails tailwindcss:watch[debug,always]`.
|
data/lib/tailwindcss/commands.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "tailwindcss/ruby"
|
|
|
3
3
|
module Tailwindcss
|
|
4
4
|
module Commands
|
|
5
5
|
class << self
|
|
6
|
-
def compile_command(debug: false, **kwargs)
|
|
6
|
+
def compile_command(debug: false, silent: false, **kwargs)
|
|
7
7
|
debug = ENV["TAILWINDCSS_DEBUG"].present? if ENV.key?("TAILWINDCSS_DEBUG")
|
|
8
8
|
rails_root = defined?(Rails) ? Rails.root : Pathname.new(Dir.pwd)
|
|
9
9
|
|
|
@@ -14,6 +14,7 @@ module Tailwindcss
|
|
|
14
14
|
]
|
|
15
15
|
|
|
16
16
|
command << "--minify" unless (debug || rails_css_compressor?)
|
|
17
|
+
command << "--silent" if silent
|
|
17
18
|
|
|
18
19
|
postcss_path = rails_root.join("postcss.config.js")
|
|
19
20
|
command += ["--postcss", postcss_path.to_s] if File.exist?(postcss_path)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module Tailwindcss
|
|
2
|
+
# Runs a child process and forwards stop signals (INT/TERM) to it, blocking
|
|
3
|
+
# until it exits, so a process manager that signals this process directly
|
|
4
|
+
# (e.g. foreman) doesn't leave the child orphaned. Shaped like
|
|
5
|
+
# +Process.spawn+/+Kernel#system+: it takes an +env+ hash followed by the
|
|
6
|
+
# command.
|
|
7
|
+
module ProcessRunner
|
|
8
|
+
# Signals we forward to the spawned process so it shuts down with us instead
|
|
9
|
+
# of being orphaned.
|
|
10
|
+
FORWARDED_SIGNALS = %w[INT TERM].freeze
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
# Spawn +command+ with +env+ and block until it exits, forwarding INT
|
|
14
|
+
# (Ctrl-C) and TERM (e.g. foreman shutdown) to it so a process manager
|
|
15
|
+
# that signals us directly doesn't leave an orphaned child behind.
|
|
16
|
+
# Restores the previous signal handlers before returning so the
|
|
17
|
+
# process-global traps aren't left changed. Returns the name of the signal
|
|
18
|
+
# that was received (e.g. "TERM"), or nil if the child exited on its own.
|
|
19
|
+
def spawn_and_wait(env, *command)
|
|
20
|
+
pid = nil
|
|
21
|
+
received_signal = nil
|
|
22
|
+
previous_traps = {}
|
|
23
|
+
|
|
24
|
+
forward_signal = ->(signal) do
|
|
25
|
+
if pid
|
|
26
|
+
Process.kill(signal, pid)
|
|
27
|
+
end
|
|
28
|
+
rescue Errno::ESRCH
|
|
29
|
+
# the child already exited
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Trap immediately before spawning. If a signal lands before pid is
|
|
33
|
+
# assigned, remember it and forward it once the child exists.
|
|
34
|
+
FORWARDED_SIGNALS.each do |signal|
|
|
35
|
+
previous_traps[signal] = trap(signal) do
|
|
36
|
+
received_signal ||= signal
|
|
37
|
+
forward_signal.call(signal)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
pid = Process.spawn(env, *command)
|
|
42
|
+
# If a signal arrived during spawn (before pid was set), the handler
|
|
43
|
+
# couldn't forward it yet, so forward it now.
|
|
44
|
+
if received_signal
|
|
45
|
+
forward_signal.call(received_signal)
|
|
46
|
+
end
|
|
47
|
+
Process.wait(pid)
|
|
48
|
+
# Drop the pid so a late signal can't kill a process that reused it.
|
|
49
|
+
pid = nil
|
|
50
|
+
|
|
51
|
+
received_signal
|
|
52
|
+
ensure
|
|
53
|
+
previous_traps.each do |signal, previous_trap|
|
|
54
|
+
trap(signal, previous_trap)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/tailwindcss/version.rb
CHANGED
data/lib/tailwindcss-rails.rb
CHANGED
data/lib/tasks/build.rake
CHANGED
|
@@ -2,9 +2,10 @@ namespace :tailwindcss do
|
|
|
2
2
|
desc "Build your Tailwind CSS"
|
|
3
3
|
task build: [:environment, :engines] do |_, args|
|
|
4
4
|
debug = args.extras.include?("debug")
|
|
5
|
+
silent = args.extras.include?("silent")
|
|
5
6
|
verbose = args.extras.include?("verbose")
|
|
6
7
|
|
|
7
|
-
command = Tailwindcss::Commands.compile_command(debug: debug)
|
|
8
|
+
command = Tailwindcss::Commands.compile_command(debug: debug, silent: silent)
|
|
8
9
|
env = Tailwindcss::Commands.command_env(verbose: verbose)
|
|
9
10
|
puts "Running: #{Shellwords.join(command)}" if verbose
|
|
10
11
|
|
|
@@ -15,15 +16,15 @@ namespace :tailwindcss do
|
|
|
15
16
|
task watch: [:environment, :engines] do |_, args|
|
|
16
17
|
debug = args.extras.include?("debug")
|
|
17
18
|
always = args.extras.include?("always")
|
|
19
|
+
silent = args.extras.include?("silent")
|
|
18
20
|
verbose = args.extras.include?("verbose")
|
|
19
21
|
|
|
20
|
-
command = Tailwindcss::Commands.watch_command(always: always, debug: debug)
|
|
22
|
+
command = Tailwindcss::Commands.watch_command(always: always, debug: debug, silent: silent)
|
|
21
23
|
env = Tailwindcss::Commands.command_env(verbose: verbose)
|
|
22
24
|
puts "Running: #{Shellwords.join(command)}" if verbose
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
puts "Received interrupt, exiting tailwindcss:watch" if args.extras.include?("verbose")
|
|
26
|
+
received_signal = Tailwindcss::ProcessRunner.spawn_and_wait(env, *command)
|
|
27
|
+
puts "Received #{received_signal}, exiting tailwindcss:watch" if verbose && received_signal
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
desc "Create Tailwind CSS entry point files for Rails Engines"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tailwindcss-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -74,6 +74,7 @@ files:
|
|
|
74
74
|
- lib/tailwindcss/commands.rb
|
|
75
75
|
- lib/tailwindcss/engine.rb
|
|
76
76
|
- lib/tailwindcss/engines.rb
|
|
77
|
+
- lib/tailwindcss/process_runner.rb
|
|
77
78
|
- lib/tailwindcss/upstream.rb
|
|
78
79
|
- lib/tailwindcss/version.rb
|
|
79
80
|
- lib/tasks/build.rake
|
|
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
111
112
|
- !ruby/object:Gem::Version
|
|
112
113
|
version: 3.2.0
|
|
113
114
|
requirements: []
|
|
114
|
-
rubygems_version:
|
|
115
|
+
rubygems_version: 4.0.6
|
|
115
116
|
specification_version: 4
|
|
116
117
|
summary: Integrate Tailwind CSS with the asset pipeline in Rails.
|
|
117
118
|
test_files: []
|