tailwindcss-rails 3.1.0 → 3.3.2
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 +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 +8 -4
- data/lib/tailwindcss/version.rb +1 -1
- data/lib/tasks/build.rake +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee1e391824b503c8e61b8a2febd7ccd47d31614bfefd933e272a70e6b02f7e9a
|
4
|
+
data.tar.gz: 0b19a09424bdf6f2b8a74bc0cff3867373bd1a6c04c20ecb83ccdb1e2528d8eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce439d9897933e3c38d64a1bf6459d47cbe9ebf7daa0c79dac66dd1e7e62012eb0602dc0adb2bf239a37c9d2709e429a8912d1918768a777abb9bc5454354e36
|
7
|
+
data.tar.gz: 14b70eee495bc67c4f465c041345d48acc5d985a3a06b2fead4bea4f90e5c521eb2aa854fa4f67b3df244aa4d63239bbd27ae1d9edab28a2790d322f3eb75023
|
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::ENV, 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
@@ -2,18 +2,22 @@ require "tailwindcss/ruby"
|
|
2
2
|
|
3
3
|
module Tailwindcss
|
4
4
|
module Commands
|
5
|
+
ENV = {'BROWSERSLIST_IGNORE_OLD_DATA' => '1'}
|
6
|
+
|
5
7
|
class << self
|
6
8
|
def compile_command(debug: false, **kwargs)
|
9
|
+
rails_root = defined?(Rails) ? Rails.root : Pathname.new(Dir.pwd)
|
10
|
+
|
7
11
|
command = [
|
8
12
|
Tailwindcss::Ruby.executable(**kwargs),
|
9
|
-
"-i",
|
10
|
-
"-o",
|
11
|
-
"-c",
|
13
|
+
"-i", rails_root.join("app/assets/stylesheets/application.tailwind.css").to_s,
|
14
|
+
"-o", rails_root.join("app/assets/builds/tailwind.css").to_s,
|
15
|
+
"-c", rails_root.join("config/tailwind.config.js").to_s,
|
12
16
|
]
|
13
17
|
|
14
18
|
command << "--minify" unless (debug || rails_css_compressor?)
|
15
19
|
|
16
|
-
postcss_path =
|
20
|
+
postcss_path = rails_root.join("config/postcss.config.js")
|
17
21
|
command += ["--postcss", postcss_path.to_s] if File.exist?(postcss_path)
|
18
22
|
|
19
23
|
command
|
data/lib/tailwindcss/version.rb
CHANGED
data/lib/tasks/build.rake
CHANGED
@@ -4,7 +4,7 @@ namespace :tailwindcss do
|
|
4
4
|
debug = args.extras.include?("debug")
|
5
5
|
command = Tailwindcss::Commands.compile_command(debug: debug)
|
6
6
|
puts command.inspect if args.extras.include?("verbose")
|
7
|
-
system(*command, exception: true)
|
7
|
+
system(Tailwindcss::Commands::ENV, *command, exception: true)
|
8
8
|
end
|
9
9
|
|
10
10
|
desc "Watch and build your Tailwind CSS on file changes"
|
@@ -14,7 +14,7 @@ namespace :tailwindcss do
|
|
14
14
|
always = args.extras.include?("always")
|
15
15
|
command = Tailwindcss::Commands.watch_command(always: always, debug: debug, poll: poll)
|
16
16
|
puts command.inspect if args.extras.include?("verbose")
|
17
|
-
system(*command)
|
17
|
+
system(Tailwindcss::Commands::ENV, *command)
|
18
18
|
rescue Interrupt
|
19
19
|
puts "Received interrupt, exiting tailwindcss:watch" if args.extras.include?("verbose")
|
20
20
|
end
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: railties
|
@@ -27,16 +27,16 @@ dependencies:
|
|
27
27
|
name: tailwindcss-ruby
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- - "
|
30
|
+
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
32
|
+
version: '3.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
39
|
+
version: '3.0'
|
40
40
|
email: david@loudthinking.com
|
41
41
|
executables: []
|
42
42
|
extensions: []
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: 3.2.0
|
116
116
|
requirements: []
|
117
|
-
rubygems_version: 3.6.
|
117
|
+
rubygems_version: 3.6.8
|
118
118
|
specification_version: 4
|
119
119
|
summary: Integrate Tailwind CSS with the asset pipeline in Rails.
|
120
120
|
test_files: []
|