tailwindcss-rails 3.1.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -2
- data/lib/generators/tailwindcss/authentication/templates/app/views/passwords/edit.html.erb +1 -1
- data/lib/generators/tailwindcss/authentication/templates/app/views/passwords/new.html.erb +1 -1
- data/lib/generators/tailwindcss/authentication/templates/app/views/sessions/new.html.erb +2 -2
- data/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt +11 -11
- data/lib/generators/tailwindcss/scaffold/templates/edit.html.erb.tt +5 -3
- data/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt +13 -9
- data/lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt +4 -2
- data/lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt +0 -1
- data/lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt +15 -13
- data/lib/puma/plugin/tailwindcss.rb +6 -2
- data/lib/tailwindcss/commands.rb +6 -4
- data/lib/tailwindcss/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd08ba39cdbf3e583632419190f2918a4eb004ebff05433a43456342ccfece80
|
4
|
+
data.tar.gz: 6d393169b40195bebbde219bc1f39d7351a6623f346bd36792b65b24210ad5df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 949b84bfd22f8ff03581c1826026c581601a8659dbfd4d156f62806f9a16ca2ac3a7f3ce816c394d82bd6cf6d9e04029e400a71b73fe1f52cde82e5c122d9f27
|
7
|
+
data.tar.gz: 65e70ea1e978c11286993ee62503cb945aa894a1ab0f2f5a156647e68fcbd1c4b0c0732ee31d7e71007cc7147f0f1362398f80fdf7b67eca6794d9925a6e46a9
|
data/README.md
CHANGED
@@ -124,7 +124,7 @@ This gem ships with a Puma plugin. To use it, add this line to your `puma.rb` co
|
|
124
124
|
plugin :tailwindcss if ENV.fetch("RAILS_ENV", "development") == "development"
|
125
125
|
```
|
126
126
|
|
127
|
-
and then running `rails server` will run the Tailwind watch process in the background
|
127
|
+
and then running `rails server` (or just `puma`) will run the Tailwind watch process in the background.
|
128
128
|
|
129
129
|
|
130
130
|
#### Run `rails tailwindcss:watch`
|
@@ -151,7 +151,7 @@ Running `bin/dev` invokes Foreman to start both the Tailwind watch process and t
|
|
151
151
|
|
152
152
|
### Using with PostCSS
|
153
153
|
|
154
|
-
If you want to use PostCSS as a preprocessor, create a custom `config/postcss.config.js` and
|
154
|
+
If you want to use PostCSS as a preprocessor, create a custom `config/postcss.config.js` and that file will be loaded by tailwind automatically.
|
155
155
|
|
156
156
|
For example, to enable nesting:
|
157
157
|
|
@@ -167,6 +167,25 @@ module.exports = {
|
|
167
167
|
}
|
168
168
|
```
|
169
169
|
|
170
|
+
⚠ Note that PostCSS is a javascript tool with its own prerequisites! By default `tailwindcss-rails` does not require any javascript tooling, so in order to use PostCSS, a `package.json` with dependencies for your plugins and a package manager like `yarn` or `npm` is required, for example:
|
171
|
+
|
172
|
+
```json
|
173
|
+
// package.json
|
174
|
+
{
|
175
|
+
"name": "my app",
|
176
|
+
"private": true,
|
177
|
+
"dependencies": {
|
178
|
+
"postcss-advanced-variables": "^4.0.0",
|
179
|
+
"postcss-import": "^16.0.1",
|
180
|
+
"postcss-mixins": "^9.0.4",
|
181
|
+
"tailwindcss": "^3.4.1"
|
182
|
+
}
|
183
|
+
}
|
184
|
+
```
|
185
|
+
|
186
|
+
Then you can use yarn or npm to install the dependencies.
|
187
|
+
|
188
|
+
|
170
189
|
### Custom inputs or outputs
|
171
190
|
|
172
191
|
If you need to use a custom input or output file, you can run `bundle exec tailwindcss` to access the platform-specific executable, and give it your own build options.
|
@@ -15,7 +15,7 @@
|
|
15
15
|
</div>
|
16
16
|
|
17
17
|
<div class="inline">
|
18
|
-
<%%= form.submit "Save", class: "rounded-
|
18
|
+
<%%= form.submit "Save", class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
|
19
19
|
</div>
|
20
20
|
<%% end %>
|
21
21
|
</div>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
</div>
|
12
12
|
|
13
13
|
<div class="inline">
|
14
|
-
<%%= form.submit "Email reset instructions", class: "rounded-lg
|
14
|
+
<%%= form.submit "Email reset instructions", class: "rounded-lg px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
|
15
15
|
</div>
|
16
16
|
<%% end %>
|
17
17
|
</div>
|
@@ -20,11 +20,11 @@
|
|
20
20
|
|
21
21
|
<div class="col-span-6 sm:flex sm:items-center sm:gap-4">
|
22
22
|
<div class="inline">
|
23
|
-
<%%= form.submit "Sign in", class: "rounded-
|
23
|
+
<%%= form.submit "Sign in", class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
|
24
24
|
</div>
|
25
25
|
|
26
26
|
<div class="mt-4 text-sm text-gray-500 sm:mt-0">
|
27
|
-
<%%= link_to "Forgot password?", new_password_path, class: "text-gray-700 underline" %>
|
27
|
+
<%%= link_to "Forgot password?", new_password_path, class: "text-gray-700 underline hover:no-underline" %>
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
<%% end %>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%%= form_with(model: <%= model_resource_name %>, class: "contents") do |form| %>
|
2
2
|
<%% if <%= singular_table_name %>.errors.any? %>
|
3
|
-
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-
|
3
|
+
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-md mt-3">
|
4
4
|
<h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
5
5
|
|
6
|
-
<ul>
|
6
|
+
<ul class="list-disc ml-6">
|
7
7
|
<%% <%= singular_table_name %>.errors.each do |error| %>
|
8
8
|
<li><%%= error.full_message %></li>
|
9
9
|
<%% end %>
|
@@ -15,29 +15,29 @@
|
|
15
15
|
<div class="my-5">
|
16
16
|
<% if attribute.password_digest? -%>
|
17
17
|
<%%= form.label :password %>
|
18
|
-
<%%= form.password_field :password, class: "block shadow rounded-md border
|
19
|
-
</div>
|
18
|
+
<%%= form.password_field :password, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password].any?}] %>
|
19
|
+
</div>
|
20
20
|
|
21
|
-
<div class="my-5">
|
21
|
+
<div class="my-5">
|
22
22
|
<%%= form.label :password_confirmation %>
|
23
|
-
<%%= form.password_field :password_confirmation, class: "block shadow rounded-md border
|
23
|
+
<%%= form.password_field :password_confirmation, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password_confirmation].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password_confirmation].any?}] %>
|
24
24
|
<% elsif attribute.attachments? -%>
|
25
25
|
<%%= form.label :<%= attribute.column_name %> %>
|
26
|
-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: "block shadow rounded-md border
|
26
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password].any?}] %>
|
27
27
|
<% else -%>
|
28
28
|
<%%= form.label :<%= attribute.column_name %> %>
|
29
29
|
<% if attribute.field_type == :textarea || attribute.field_type == :text_area -%>
|
30
|
-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: "block shadow rounded-md border
|
30
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
|
31
31
|
<% elsif attribute.field_type == :checkbox || attribute.field_type == :check_box -%>
|
32
|
-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block shadow rounded-md border border-gray-400
|
32
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: ["block shadow rounded-md border outline-none mt-2 h-5 w-5", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
|
33
33
|
<% else -%>
|
34
|
-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block shadow rounded-md border
|
34
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: ["block shadow rounded-md border outline-none px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
|
35
35
|
<% end -%>
|
36
36
|
<% end -%>
|
37
37
|
</div>
|
38
38
|
|
39
39
|
<% end -%>
|
40
40
|
<div class="inline">
|
41
|
-
<%%= form.submit class: "rounded-
|
41
|
+
<%%= form.submit class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
|
42
42
|
</div>
|
43
43
|
<%% end %>
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
<%% content_for :title, "Editing <%= human_name.downcase %>" %>
|
2
|
+
|
3
|
+
<div class="md:w-2/3 w-full">
|
2
4
|
<h1 class="font-bold text-4xl">Editing <%= human_name.downcase %></h1>
|
3
5
|
|
4
6
|
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
|
5
7
|
|
6
|
-
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, class: "ml-2 rounded-
|
7
|
-
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "ml-2 rounded-
|
8
|
+
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
9
|
+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
8
10
|
</div>
|
@@ -1,21 +1,25 @@
|
|
1
|
+
<%% content_for :title, "<%= human_name.pluralize %>" %>
|
2
|
+
|
1
3
|
<div class="w-full">
|
2
4
|
<%% if notice.present? %>
|
3
|
-
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-
|
5
|
+
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%%= notice %></p>
|
4
6
|
<%% end %>
|
5
7
|
|
6
|
-
<%% content_for :title, "<%= human_name.pluralize %>" %>
|
7
|
-
|
8
8
|
<div class="flex justify-between items-center">
|
9
9
|
<h1 class="font-bold text-4xl"><%= human_name.pluralize %></h1>
|
10
|
-
<%%= link_to "New <%= human_name.downcase %>", new_<%= singular_route_name %>_path, class: "rounded-
|
10
|
+
<%%= link_to "New <%= human_name.downcase %>", new_<%= singular_route_name %>_path, class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white block font-medium" %>
|
11
11
|
</div>
|
12
12
|
|
13
13
|
<div id="<%= plural_table_name %>" class="min-w-full">
|
14
|
-
<%% @<%= plural_table_name %>.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
<%% if @<%= plural_table_name %>.any? %>
|
15
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
16
|
+
<%%= render <%= singular_table_name %> %>
|
17
|
+
<p>
|
18
|
+
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
19
|
+
</p>
|
20
|
+
<%% end %>
|
21
|
+
<%% else %>
|
22
|
+
<p class="text-center my-10">No <%= human_name.downcase.pluralize %> found.</p>
|
19
23
|
<%% end %>
|
20
24
|
</div>
|
21
25
|
</div>
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
<%% content_for :title, "New <%= human_name.downcase %>" %>
|
2
|
+
|
3
|
+
<div class="md:w-2/3 w-full">
|
2
4
|
<h1 class="font-bold text-4xl">New <%= human_name.downcase %></h1>
|
3
5
|
|
4
6
|
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
|
5
7
|
|
6
|
-
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "ml-2 rounded-
|
8
|
+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
7
9
|
</div>
|
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
<%% content_for :title, "Showing <%= human_name.downcase %>" %>
|
2
|
+
|
3
|
+
<div class="md:w-2/3 w-full">
|
4
|
+
<%% if notice.present? %>
|
5
|
+
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%%= notice %></p>
|
6
|
+
<%% end %>
|
7
|
+
|
8
|
+
<h1 class="font-bold text-4xl">Showing <%= human_name.downcase %></h1>
|
9
|
+
|
10
|
+
<%%= render @<%= singular_table_name %> %>
|
11
|
+
|
12
|
+
<%%= link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %>, class: "mt-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
13
|
+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
14
|
+
<div class="inline-block ml-2">
|
15
|
+
<%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, class: "mt-2 rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium" %>
|
14
16
|
</div>
|
15
17
|
</div>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "puma/plugin"
|
2
|
+
require "tailwindcss/commands"
|
2
3
|
|
3
4
|
Puma::Plugin.create do
|
4
5
|
attr_reader :puma_pid, :tailwind_pid, :log_writer
|
@@ -11,8 +12,11 @@ Puma::Plugin.create do
|
|
11
12
|
# Using IO.popen(command, 'r+') will avoid watch_command read from $stdin.
|
12
13
|
# If we use system(*command) instead, IRB and Debug can't read from $stdin
|
13
14
|
# correctly bacause some keystrokes will be taken by watch_command.
|
14
|
-
|
15
|
-
IO.
|
15
|
+
begin
|
16
|
+
IO.popen(Tailwindcss::Commands.watch_command, 'r+') do |io|
|
17
|
+
IO.copy_stream(io, $stdout)
|
18
|
+
end
|
19
|
+
rescue Interrupt
|
16
20
|
end
|
17
21
|
end
|
18
22
|
|
data/lib/tailwindcss/commands.rb
CHANGED
@@ -4,16 +4,18 @@ module Tailwindcss
|
|
4
4
|
module Commands
|
5
5
|
class << self
|
6
6
|
def compile_command(debug: false, **kwargs)
|
7
|
+
rails_root = defined?(Rails) ? Rails.root : Pathname.new(Dir.pwd)
|
8
|
+
|
7
9
|
command = [
|
8
10
|
Tailwindcss::Ruby.executable(**kwargs),
|
9
|
-
"-i",
|
10
|
-
"-o",
|
11
|
-
"-c",
|
11
|
+
"-i", rails_root.join("app/assets/stylesheets/application.tailwind.css").to_s,
|
12
|
+
"-o", rails_root.join("app/assets/builds/tailwind.css").to_s,
|
13
|
+
"-c", rails_root.join("config/tailwind.config.js").to_s,
|
12
14
|
]
|
13
15
|
|
14
16
|
command << "--minify" unless (debug || rails_css_compressor?)
|
15
17
|
|
16
|
-
postcss_path =
|
18
|
+
postcss_path = rails_root.join("config/postcss.config.js")
|
17
19
|
command += ["--postcss", postcss_path.to_s] if File.exist?(postcss_path)
|
18
20
|
|
19
21
|
command
|
data/lib/tailwindcss/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailwindcss-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 2025-01-19 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: railties
|