tailwindcss-rails 2.0.24 → 2.0.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cc5f29de93eeb3395f77afbbe7ad5d869b27f34e78cd4ec0a134c98ab93ae2d
4
- data.tar.gz: 2ea2a7fdab7755cddc55a9a3b1cce290c53997bae1ef9c3ebcf326230b92db6e
3
+ metadata.gz: eb9d8f1440e51b0b218998c75371cdecbe507b3c9094d052fa6d5d8145f8a8c6
4
+ data.tar.gz: 9dd8ce840b9a81501eda3167fc2d730c5d8330b9a38227cc63101fd1e39e1d9d
5
5
  SHA512:
6
- metadata.gz: 7d653d5ad33ca2e1baabb5810cb64e9a92e95ada2b8f194fbaf1d3feac688792ab6d730c726d665918b4b5f33809d6a166bc7052c5f68f0b862beea2d0bd0f72
7
- data.tar.gz: 3ff8b9308f3abb7740660d72be0491e6cf1438105d97945b8a026f611a38e1742efbf4dcc13a15fa51506118fd65d1b088cd5c9b976f217c2b8b742afa32079e
6
+ metadata.gz: 006b91990412847a8a4795ae5e74a286c5418c4cb13c18bcdcd5de33891951a62767c699b55f306c3f0dcec72d98b965be008abe5c764160f2066c2a41935504
7
+ data.tar.gz: 19ddfac65eaebdfe5f206666bad2bcbe836f100a1fc0e22dbc04b7b43910fb287fc44e11c89aade63700dcebe4035ea0dcd18241b7abb6c06fdda4cc1a2c9e8c
data/README.md CHANGED
@@ -9,7 +9,34 @@ With Rails 7 you can generate a new application preconfigured with Tailwind by u
9
9
  1. Run `./bin/bundle add tailwindcss-rails`
10
10
  2. Run `./bin/rails tailwindcss:install`
11
11
 
12
- This gem wraps [the standalone executable version](https://tailwindcss.com/blog/standalone-cli) of the Tailwind CSS v3 framework. These executables are platform specific, so there are actually separate underlying gems per platform, but the correct gem will automatically be picked for your platform. Supported platforms are Linux x64, macOS arm64, macOS x64, and Windows x64. (Note that due to this setup, you must install the actual gems – you can't pin your gem to the github repo.)
12
+ This gem wraps [the standalone executable version](https://tailwindcss.com/blog/standalone-cli) of the Tailwind CSS v3 framework. These executables are platform specific, so there are actually separate underlying gems per platform, but the correct gem will automatically be picked for your platform.
13
+
14
+ Supported platforms are:
15
+
16
+ - arm64-darwin (macos-arm64)
17
+ - x64-mingw32 (windows-x64)
18
+ - x64-mingw-ucr (windows-x64)
19
+ - x86_64-darwin (macos-x64)
20
+ - x86_64-linux (linux-x64)
21
+ - aarch64-linux (linux-arm64)
22
+ - arm-linux (linux-armv7)
23
+
24
+
25
+ ### Using a local installation of `tailwindcss`
26
+
27
+ If you are not able to use the vendored standalone executables (for example, if you're on an unsupported platform), you can use a local installation of the `tailwindcss` executable by setting an environment variable named `TAILWINDCSS_INSTALL_DIR` to the directory containing the executable.
28
+
29
+ For example, if you've installed `tailwindcss` so that the executable is found at `/node_modules/bin/tailwindcss`, then you should set your environment variable like so:
30
+
31
+ ``` sh
32
+ TAILWINDCSS_INSTALL_DIR=/path/to/node_modules/bin
33
+ ```
34
+
35
+ This also works with relative paths. If you've installed into your app's directory at `./node_modules/.bin/tailwindcss`:
36
+
37
+ ``` sh
38
+ TAILWINDCSS_INSTALL_DIR=node_modules/.bin
39
+ ```
13
40
 
14
41
 
15
42
  ## Developing with Tailwindcss
@@ -43,9 +70,11 @@ While you're developing your application, you want to run Tailwind in "watch" mo
43
70
  - running `rails tailwindcss:watch` as a separate process,
44
71
  - 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.
45
72
 
73
+ 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`.
74
+
46
75
  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.
47
76
 
48
- 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`.
77
+ 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`.
49
78
 
50
79
 
51
80
  ### Debugging with unminified assets
@@ -18,5 +18,6 @@ module.exports = {
18
18
  require('@tailwindcss/forms'),
19
19
  require('@tailwindcss/aspect-ratio'),
20
20
  require('@tailwindcss/typography'),
21
+ require('@tailwindcss/container-queries'),
21
22
  ]
22
23
  }
@@ -2,6 +2,8 @@ require_relative "upstream"
2
2
 
3
3
  module Tailwindcss
4
4
  module Commands
5
+ DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "..", "exe"))
6
+
5
7
  # raised when the host platform is not supported by upstream tailwindcss's binary releases
6
8
  class UnsupportedPlatformException < StandardError
7
9
  end
@@ -10,26 +12,41 @@ module Tailwindcss
10
12
  class ExecutableNotFoundException < StandardError
11
13
  end
12
14
 
15
+ # raised when TAILWINDCSS_INSTALL_DIR does not exist
16
+ class DirectoryNotFoundException < StandardError
17
+ end
18
+
13
19
  class << self
14
20
  def platform
15
21
  [:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
16
22
  end
17
23
 
18
- def executable(
19
- exe_path: File.expand_path(File.join(__dir__, "..", "..", "exe"))
20
- )
21
- if Tailwindcss::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match(Gem::Platform.new(p)) }
22
- raise UnsupportedPlatformException, <<~MESSAGE
23
- tailwindcss-rails does not support the #{platform} platform
24
- Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
25
- MESSAGE
26
- end
27
-
28
- exe_path = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
29
- Gem::Platform.match(Gem::Platform.new(File.basename(File.dirname(f))))
24
+ def executable(exe_path: DEFAULT_DIR)
25
+ tailwindcss_install_dir = ENV["TAILWINDCSS_INSTALL_DIR"]
26
+ if tailwindcss_install_dir
27
+ if File.directory?(tailwindcss_install_dir)
28
+ warn "NOTE: using TAILWINDCSS_INSTALL_DIR to find tailwindcss executable: #{tailwindcss_install_dir}"
29
+ exe_path = tailwindcss_install_dir
30
+ exe_file = File.expand_path(File.join(tailwindcss_install_dir, "tailwindcss"))
31
+ else
32
+ raise DirectoryNotFoundException, <<~MESSAGE
33
+ TAILWINDCSS_INSTALL_DIR is set to #{tailwindcss_install_dir}, but that directory does not exist.
34
+ MESSAGE
35
+ end
36
+ else
37
+ if Tailwindcss::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match(Gem::Platform.new(p)) }
38
+ raise UnsupportedPlatformException, <<~MESSAGE
39
+ tailwindcss-rails does not support the #{platform} platform
40
+ Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
41
+ MESSAGE
42
+ end
43
+
44
+ exe_file = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
45
+ Gem::Platform.match(Gem::Platform.new(File.basename(File.dirname(f))))
46
+ end
30
47
  end
31
48
 
32
- if exe_path.nil?
49
+ if exe_file.nil? || !File.exist?(exe_file)
33
50
  raise ExecutableNotFoundException, <<~MESSAGE
34
51
  Cannot find the tailwindcss executable for #{platform} in #{exe_path}
35
52
 
@@ -52,7 +69,7 @@ module Tailwindcss
52
69
  MESSAGE
53
70
  end
54
71
 
55
- exe_path
72
+ exe_file
56
73
  end
57
74
 
58
75
  def compile_command(debug: false, **kwargs)
@@ -66,9 +83,10 @@ module Tailwindcss
66
83
  end
67
84
  end
68
85
 
69
- def watch_command(poll: false, **kwargs)
86
+ def watch_command(always: false, poll: false, **kwargs)
70
87
  compile_command(**kwargs).tap do |command|
71
88
  command << "-w"
89
+ command << "always" if always
72
90
  command << "-p" if poll
73
91
  end
74
92
  end
@@ -1,7 +1,7 @@
1
1
  module Tailwindcss
2
2
  # constants describing the upstream tailwindcss project
3
3
  module Upstream
4
- VERSION = "v3.2.7"
4
+ VERSION = "v3.3.2"
5
5
 
6
6
  # rubygems platform name => upstream release filename
7
7
  NATIVE_PLATFORMS = {
@@ -1,3 +1,3 @@
1
1
  module Tailwindcss
2
- VERSION = "2.0.24"
2
+ VERSION = "2.0.29"
3
3
  end
data/lib/tasks/build.rake CHANGED
@@ -11,7 +11,8 @@ namespace :tailwindcss do
11
11
  task watch: :environment do |_, args|
12
12
  debug = args.extras.include?("debug")
13
13
  poll = args.extras.include?("poll")
14
- command = Tailwindcss::Commands.watch_command(debug: debug, poll: poll)
14
+ always = args.extras.include?("always")
15
+ command = Tailwindcss::Commands.watch_command(always: always, debug: debug, poll: poll)
15
16
  puts command.inspect if args.extras.include?("verbose")
16
17
  system(*command)
17
18
  end
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.0.24
4
+ version: 2.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-05 00:00:00.000000000 Z
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -24,6 +24,7 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 6.0.0
27
+ force_ruby_platform: false
27
28
  description:
28
29
  email: david@loudthinking.com
29
30
  executables:
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  - !ruby/object:Gem::Version
99
100
  version: '0'
100
101
  requirements: []
101
- rubygems_version: 3.4.1
102
+ rubygems_version: 3.4.10
102
103
  signing_key:
103
104
  specification_version: 4
104
105
  summary: Integrate Tailwind CSS with the asset pipeline in Rails.