tailwindcss-rails 3.3.2 → 4.3.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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +279 -56
  3. data/lib/generators/tailwindcss/authentication/authentication_generator.rb +2 -0
  4. data/lib/generators/tailwindcss/authentication/templates/app/views/passwords/edit.html.erb +3 -3
  5. data/lib/generators/tailwindcss/authentication/templates/app/views/passwords/new.html.erb +2 -2
  6. data/lib/generators/tailwindcss/authentication/templates/app/views/sessions/new.html.erb +3 -3
  7. data/lib/generators/tailwindcss/scaffold/scaffold_generator.rb +1 -0
  8. data/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt +8 -8
  9. data/lib/generators/tailwindcss/scaffold/templates/edit.html.erb.tt +2 -2
  10. data/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt +9 -5
  11. data/lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt +1 -1
  12. data/lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt +7 -5
  13. data/lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt +3 -5
  14. data/lib/generators/test_unit/scaffold/scaffold_generator.rb +21 -0
  15. data/lib/install/application.css +1 -0
  16. data/lib/install/{tailwindcss.rb → install_tailwindcss.rb} +12 -13
  17. data/lib/install/upgrade_tailwindcss.rb +69 -0
  18. data/lib/puma/plugin/tailwindcss.rb +1 -1
  19. data/lib/tailwindcss/commands.rb +9 -5
  20. data/lib/tailwindcss/engine.rb +6 -4
  21. data/lib/tailwindcss/engines.rb +23 -0
  22. data/lib/tailwindcss/version.rb +1 -1
  23. data/lib/tailwindcss-rails.rb +1 -0
  24. data/lib/tasks/build.rake +19 -6
  25. data/lib/tasks/install.rake +1 -1
  26. data/lib/tasks/upgrade.rake +6 -0
  27. metadata +22 -24
  28. data/app/assets/fonts/Inter-italic.alternates.var.woff2 +0 -0
  29. data/app/assets/fonts/Inter-italic.cyrillic.var.woff2 +0 -0
  30. data/app/assets/fonts/Inter-italic.extra.var.woff2 +0 -0
  31. data/app/assets/fonts/Inter-italic.greek.var.woff2 +0 -0
  32. data/app/assets/fonts/Inter-italic.latin-ext.var.woff2 +0 -0
  33. data/app/assets/fonts/Inter-italic.latin.var.woff2 +0 -0
  34. data/app/assets/fonts/Inter-italic.symbols.var.woff2 +0 -0
  35. data/app/assets/fonts/Inter-italic.vietnamese.var.woff2 +0 -0
  36. data/app/assets/fonts/Inter-roman.alternates.var.woff2 +0 -0
  37. data/app/assets/fonts/Inter-roman.cyrillic.var.woff2 +0 -0
  38. data/app/assets/fonts/Inter-roman.extra.var.woff2 +0 -0
  39. data/app/assets/fonts/Inter-roman.greek.var.woff2 +0 -0
  40. data/app/assets/fonts/Inter-roman.latin-ext.var.woff2 +0 -0
  41. data/app/assets/fonts/Inter-roman.latin.var.woff2 +0 -0
  42. data/app/assets/fonts/Inter-roman.symbols.var.woff2 +0 -0
  43. data/app/assets/fonts/Inter-roman.vietnamese.var.woff2 +0 -0
  44. data/app/assets/stylesheets/inter-font.css +0 -194
  45. data/lib/install/application.tailwind.css +0 -13
  46. data/lib/install/tailwind.config.js +0 -22
@@ -10,13 +10,17 @@
10
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
- <div id="<%= plural_table_name %>" class="min-w-full">
13
+ <div id="<%= plural_table_name %>" class="min-w-full divide-y divide-gray-200 space-y-5">
14
14
  <%% if @<%= plural_table_name %>.any? %>
15
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>
16
+ <div class="flex flex-col sm:flex-row justify-between items-center pb-5 sm:pb-0">
17
+ <%%= render <%= singular_table_name %> %>
18
+ <div class="w-full sm:w-auto flex flex-col sm:flex-row space-x-2 space-y-2">
19
+ <%%= link_to "Show", <%= model_resource_name(singular_table_name) %>, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
20
+ <%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
21
+ <%%= button_to "Destroy", <%= model_resource_name %>, method: :delete, class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
22
+ </div>
23
+ </div>
20
24
  <%% end %>
21
25
  <%% else %>
22
26
  <p class="text-center my-10">No <%= human_name.downcase.pluralize %> found.</p>
@@ -5,5 +5,5 @@
5
5
 
6
6
  <%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
7
7
 
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" %>
8
+ <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
9
9
  </div>
@@ -1,16 +1,18 @@
1
- <div id="<%%= dom_id <%= singular_name %> %>">
1
+ <div id="<%%= dom_id <%= singular_name %> %>" class="w-full sm:w-auto my-5 space-y-5">
2
2
  <% attributes.reject(&:password_digest?).each do |attribute| -%>
3
- <p class="my-5">
3
+ <div>
4
4
  <strong class="block font-medium mb-1"><%= attribute.human_name %>:</strong>
5
5
  <% if attribute.attachment? -%>
6
- <%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %>
6
+ <%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %>, class: "text-gray-700 underline hover:no-underline" if <%= singular_name %>.<%= attribute.column_name %>.attached? %>
7
7
  <% elsif attribute.attachments? -%>
8
8
  <%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
9
- <div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div>
9
+ <div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %>, class: "text-gray-700 underline hover:no-underline" %></div>
10
10
  <%% end %>
11
+ <% elsif attribute.type == :boolean -%>
12
+ <%%= <%= singular_name %>.<%= attribute.column_name %>? ? "Yes" : "No" %>
11
13
  <% else -%>
12
14
  <%%= <%= singular_name %>.<%= attribute.column_name %> %>
13
15
  <% end -%>
14
- </p>
16
+ </div>
15
17
  <% end -%>
16
18
  </div>
@@ -9,9 +9,7 @@
9
9
 
10
10
  <%%= render @<%= singular_table_name %> %>
11
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" %>
16
- </div>
12
+ <%%= link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %>, class: "w-full sm:w-auto text-center 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: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
14
+ <%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, form_class: "sm:inline-block mt-2 sm:mt-0 sm:ml-2", class: "w-full rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
17
15
  </div>
@@ -0,0 +1,21 @@
1
+ require "rails/generators/test_unit/scaffold/scaffold_generator"
2
+
3
+ module TestUnit # :nodoc:
4
+ module Generators # :nodoc:
5
+ class ScaffoldGenerator < Base # :nodoc:
6
+ def fix_system_test
7
+ if turbo_defined? && options[:system_tests]
8
+ gsub_file File.join("test/system", class_path, "#{file_name.pluralize}_test.rb"),
9
+ /(click_on.*Destroy this.*)$/,
10
+ "accept_confirm { \\1 }"
11
+ end
12
+ end
13
+
14
+ private
15
+
16
+ def turbo_defined?
17
+ defined?(Turbo)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -1,19 +1,23 @@
1
1
  APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
2
2
  CENTERING_CONTAINER_INSERTION_POINT = /^\s*<%= yield %>/.freeze
3
+ TAILWIND_ASSET_PATH = Rails.root.join("app/assets/tailwind/application.css")
3
4
 
4
5
  if APPLICATION_LAYOUT_PATH.exist?
5
- say "Add Tailwindcss include tags and container element in application layout"
6
- insert_into_file APPLICATION_LAYOUT_PATH.to_s, <<~ERB.indent(4), before: /^\s*<%= stylesheet_link_tag/
7
- <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
8
- ERB
6
+ unless File.read(APPLICATION_LAYOUT_PATH).match?(/stylesheet_link_tag :app/)
7
+ say "Add Tailwindcss include tags in application layout"
8
+ insert_into_file APPLICATION_LAYOUT_PATH.to_s, <<~ERB.indent(4), before: /^\s*<%= stylesheet_link_tag/
9
+ <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
10
+ ERB
11
+ end
9
12
 
13
+ say "Add Tailwindcss container element in application layout"
10
14
  if File.open(APPLICATION_LAYOUT_PATH).read =~ /<body>\n\s*<%= yield %>\n\s*<\/body>/
11
15
  insert_into_file APPLICATION_LAYOUT_PATH.to_s, %( <main class="container mx-auto mt-28 px-5 flex">\n ), before: CENTERING_CONTAINER_INSERTION_POINT
12
16
  insert_into_file APPLICATION_LAYOUT_PATH.to_s, %(\n </main>), after: CENTERING_CONTAINER_INSERTION_POINT
13
17
  end
14
18
  else
15
19
  say "Default application.html.erb is missing!", :red
16
- say %( Add <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)
20
+ say %( Add <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)
17
21
  end
18
22
 
19
23
  say "Build into app/assets/builds"
@@ -28,14 +32,9 @@ if Rails.root.join(".gitignore").exist?
28
32
  append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
29
33
  end
30
34
 
31
- unless Rails.root.join("config/tailwind.config.js").exist?
32
- say "Add default config/tailwindcss.config.js"
33
- copy_file "#{__dir__}/tailwind.config.js", "config/tailwind.config.js"
34
- end
35
-
36
- unless Rails.root.join("app/assets/stylesheets/application.tailwind.css").exist?
37
- say "Add default app/assets/stylesheets/application.tailwind.css"
38
- copy_file "#{__dir__}/application.tailwind.css", "app/assets/stylesheets/application.tailwind.css"
35
+ unless TAILWIND_ASSET_PATH.exist?
36
+ say "Add default #{TAILWIND_ASSET_PATH}"
37
+ copy_file "#{__dir__}/application.css", TAILWIND_ASSET_PATH
39
38
  end
40
39
 
41
40
  if Rails.root.join("Procfile.dev").exist?
@@ -0,0 +1,69 @@
1
+ TAILWIND_CONFIG_PATH = Rails.root.join("config/tailwind.config.js")
2
+ APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
3
+ POSTCSS_CONFIG_PATH = Rails.root.join("config/postcss.config.js")
4
+ OLD_TAILWIND_ASSET_PATH = Rails.root.join("app/assets/stylesheets/application.tailwind.css")
5
+ TAILWIND_ASSET_PATH = Rails.root.join("app/assets/tailwind/application.css")
6
+
7
+ unless TAILWIND_CONFIG_PATH.exist?
8
+ say "Default tailwind.config.js is missing!", :red
9
+ abort
10
+ end
11
+
12
+ if File.read(TAILWIND_CONFIG_PATH).match?(/defaultTheme/)
13
+ say "Removing references to 'defaultTheme' from #{TAILWIND_CONFIG_PATH}"
14
+ gsub_file TAILWIND_CONFIG_PATH.to_s, /^(.*defaultTheme)/, "// \\1"
15
+ end
16
+
17
+ if POSTCSS_CONFIG_PATH.exist?
18
+ say "Moving PostCSS configuration to application root directory"
19
+ copy_file POSTCSS_CONFIG_PATH, Rails.root.join("postcss.config.js")
20
+ remove_file POSTCSS_CONFIG_PATH
21
+ end
22
+
23
+ if APPLICATION_LAYOUT_PATH.exist?
24
+ if File.read(APPLICATION_LAYOUT_PATH).match?(/"inter-font"/)
25
+ say "Strip Inter font CSS from application layout"
26
+ gsub_file APPLICATION_LAYOUT_PATH.to_s, %r{, "inter-font"}, ""
27
+ else
28
+ say "Inter font CSS not detected.", :green
29
+ end
30
+
31
+ if File.read(APPLICATION_LAYOUT_PATH).match?(/stylesheet_link_tag :app/) &&
32
+ File.read(APPLICATION_LAYOUT_PATH).match?(/stylesheet_link_tag "tailwind"/)
33
+ say "Remove unnecessary stylesheet_link_tag from application layout"
34
+ gsub_file APPLICATION_LAYOUT_PATH.to_s, %r{^\s*<%= stylesheet_link_tag "tailwind".*%>$}, ""
35
+ end
36
+ else
37
+ say "Default application.html.erb is missing!", :red
38
+ say %( Please check your layouts and remove any "inter-font" stylesheet links.)
39
+ end
40
+
41
+ if OLD_TAILWIND_ASSET_PATH.exist?
42
+ say "Moving #{OLD_TAILWIND_ASSET_PATH} to #{TAILWIND_ASSET_PATH}"
43
+ copy_file OLD_TAILWIND_ASSET_PATH, TAILWIND_ASSET_PATH
44
+ remove_file OLD_TAILWIND_ASSET_PATH
45
+ end
46
+
47
+ if system("npx --version")
48
+ # We're pinning to v4.1.4 because v4.1.5 of the upgrade tool introduces a dependency version check
49
+ # on tailwind and I haven't been able to figure out how to get that to work reliably and I am
50
+ # extremely frustrated with the whole thing. See #544
51
+ #
52
+ # At some point we will probably need to unpin this at which point I am sincerely hoping that
53
+ # someone else will do it.
54
+ say "Running the upstream Tailwind CSS upgrader"
55
+ command = Shellwords.join(["npx", "@tailwindcss/upgrade@4.1.4", "--force", "--config", TAILWIND_CONFIG_PATH.to_s])
56
+ success = run(command, abort_on_failure: false)
57
+ unless success
58
+ say "The upgrade tool failed!", :red
59
+ say %( You probably need to update your configuration. Please read the error messages,)
60
+ say %( and check the Tailwind CSS upgrade guide at https://tailwindcss.com/docs/upgrade-guide.)
61
+ abort
62
+ end
63
+ else
64
+ say "Could not run the Tailwind upgrade tool. Please see https://tailwindcss.com/docs/upgrade-guide for manual instructions.", :red
65
+ abort
66
+ end
67
+
68
+ say "Compile initial Tailwind build"
69
+ run "rails tailwindcss:build"
@@ -13,7 +13,7 @@ Puma::Plugin.create do
13
13
  # If we use system(*command) instead, IRB and Debug can't read from $stdin
14
14
  # correctly bacause some keystrokes will be taken by watch_command.
15
15
  begin
16
- IO.popen(Tailwindcss::Commands::ENV, Tailwindcss::Commands.watch_command, 'r+') do |io|
16
+ IO.popen(Tailwindcss::Commands.watch_command, 'r+') do |io|
17
17
  IO.copy_stream(io, $stdout)
18
18
  end
19
19
  rescue Interrupt
@@ -2,22 +2,20 @@ require "tailwindcss/ruby"
2
2
 
3
3
  module Tailwindcss
4
4
  module Commands
5
- ENV = {'BROWSERSLIST_IGNORE_OLD_DATA' => '1'}
6
-
7
5
  class << self
8
6
  def compile_command(debug: false, **kwargs)
7
+ debug = ENV["TAILWINDCSS_DEBUG"].present? if ENV.key?("TAILWINDCSS_DEBUG")
9
8
  rails_root = defined?(Rails) ? Rails.root : Pathname.new(Dir.pwd)
10
9
 
11
10
  command = [
12
11
  Tailwindcss::Ruby.executable(**kwargs),
13
- "-i", rails_root.join("app/assets/stylesheets/application.tailwind.css").to_s,
12
+ "-i", rails_root.join("app/assets/tailwind/application.css").to_s,
14
13
  "-o", rails_root.join("app/assets/builds/tailwind.css").to_s,
15
- "-c", rails_root.join("config/tailwind.config.js").to_s,
16
14
  ]
17
15
 
18
16
  command << "--minify" unless (debug || rails_css_compressor?)
19
17
 
20
- postcss_path = rails_root.join("config/postcss.config.js")
18
+ postcss_path = rails_root.join("postcss.config.js")
21
19
  command += ["--postcss", postcss_path.to_s] if File.exist?(postcss_path)
22
20
 
23
21
  command
@@ -31,6 +29,12 @@ module Tailwindcss
31
29
  end
32
30
  end
33
31
 
32
+ def command_env(verbose:)
33
+ {}.tap do |env|
34
+ env["DEBUG"] = "1" if verbose
35
+ end
36
+ end
37
+
34
38
  def rails_css_compressor?
35
39
  defined?(Rails) && Rails&.application&.config&.assets&.css_compressor.present?
36
40
  end
@@ -2,14 +2,16 @@ require "rails"
2
2
 
3
3
  module Tailwindcss
4
4
  class Engine < ::Rails::Engine
5
- initializer "tailwindcss.assets" do
6
- Rails.application.config.assets.precompile += %w( inter-font.css )
7
- end
8
-
9
5
  initializer "tailwindcss.disable_generator_stylesheets" do
10
6
  Rails.application.config.generators.stylesheets = false
11
7
  end
12
8
 
9
+ initializer "tailwindcss.exclude_asset_path", before: "propshaft.append_assets_path" do
10
+ if Rails.application.config.assets.excluded_paths # the app may not be using Propshaft
11
+ Rails.application.config.assets.excluded_paths << Rails.root.join("app/assets/tailwind")
12
+ end
13
+ end
14
+
13
15
  config.app_generators do |g|
14
16
  g.template_engine :tailwindcss
15
17
  end
@@ -0,0 +1,23 @@
1
+ module Tailwindcss
2
+ module Engines
3
+ class << self
4
+ def bundle
5
+ FileUtils.mkdir_p(Rails.root.join("app/assets/builds/tailwind"))
6
+ Rails::Engine.subclasses.select do |engine|
7
+ engine.root.join("app/assets/tailwind/#{engine.engine_name}/engine.css").exist?
8
+ end.each do |engine|
9
+ file_path = Rails.root.join("app/assets/builds/tailwind/#{engine.engine_name}.css")
10
+ FileUtils.rm(file_path) if File.exist?(file_path)
11
+ template = <<~TEMPLATE
12
+ /* DO NOT MODIFY THIS FILE, it was auto-generated by tailwindcss-rails */
13
+
14
+ @import "#{engine.root.join("app/assets/tailwind/#{engine.engine_name}/engine.css")}";
15
+ TEMPLATE
16
+ File.open(file_path, 'w') do |file|
17
+ file.puts template
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Tailwindcss
2
- VERSION = "3.3.2"
2
+ VERSION = "4.3.0"
3
3
  end
@@ -2,5 +2,6 @@ module Tailwindcss
2
2
  end
3
3
 
4
4
  require_relative "tailwindcss/version"
5
+ require_relative "tailwindcss/engines"
5
6
  require_relative "tailwindcss/engine"
6
7
  require_relative "tailwindcss/commands"
data/lib/tasks/build.rake CHANGED
@@ -1,23 +1,36 @@
1
1
  namespace :tailwindcss do
2
2
  desc "Build your Tailwind CSS"
3
- task build: :environment do |_, args|
3
+ task build: [:environment, :engines] do |_, args|
4
4
  debug = args.extras.include?("debug")
5
+ verbose = args.extras.include?("verbose")
6
+
5
7
  command = Tailwindcss::Commands.compile_command(debug: debug)
6
- puts command.inspect if args.extras.include?("verbose")
7
- system(Tailwindcss::Commands::ENV, *command, exception: true)
8
+ env = Tailwindcss::Commands.command_env(verbose: verbose)
9
+ puts "Running: #{Shellwords.join(command)}" if verbose
10
+
11
+ system(env, *command, exception: true)
8
12
  end
9
13
 
10
14
  desc "Watch and build your Tailwind CSS on file changes"
11
- task watch: :environment do |_, args|
15
+ task watch: [:environment, :engines] do |_, args|
12
16
  debug = args.extras.include?("debug")
13
17
  poll = args.extras.include?("poll")
14
18
  always = args.extras.include?("always")
19
+ verbose = args.extras.include?("verbose")
20
+
15
21
  command = Tailwindcss::Commands.watch_command(always: always, debug: debug, poll: poll)
16
- puts command.inspect if args.extras.include?("verbose")
17
- system(Tailwindcss::Commands::ENV, *command)
22
+ env = Tailwindcss::Commands.command_env(verbose: verbose)
23
+ puts "Running: #{Shellwords.join(command)}" if verbose
24
+
25
+ system(env, *command)
18
26
  rescue Interrupt
19
27
  puts "Received interrupt, exiting tailwindcss:watch" if args.extras.include?("verbose")
20
28
  end
29
+
30
+ desc "Create Tailwind CSS entry point files for Rails Engines"
31
+ task engines: :environment do
32
+ Tailwindcss::Engines.bundle
33
+ end
21
34
  end
22
35
 
23
36
  Rake::Task["assets:precompile"].enhance(["tailwindcss:build"])
@@ -1,6 +1,6 @@
1
1
  namespace :tailwindcss do
2
2
  desc "Install Tailwind CSS into the app"
3
3
  task :install do
4
- system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/tailwindcss.rb", __dir__)}"
4
+ system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/install_tailwindcss.rb", __dir__)}"
5
5
  end
6
6
  end
@@ -0,0 +1,6 @@
1
+ namespace :tailwindcss do
2
+ desc "Upgrade app from Tailwind CSS v3 to v4"
3
+ task :upgrade do
4
+ system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/upgrade_tailwindcss.rb", __dir__)}"
5
+ end
6
+ end
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: 3.3.2
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '3.0'
32
+ version: '4.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: '3.0'
39
+ version: '4.0'
40
40
  email: david@loudthinking.com
41
41
  executables: []
42
42
  extensions: []
@@ -45,23 +45,6 @@ files:
45
45
  - MIT-LICENSE
46
46
  - README.md
47
47
  - Rakefile
48
- - app/assets/fonts/Inter-italic.alternates.var.woff2
49
- - app/assets/fonts/Inter-italic.cyrillic.var.woff2
50
- - app/assets/fonts/Inter-italic.extra.var.woff2
51
- - app/assets/fonts/Inter-italic.greek.var.woff2
52
- - app/assets/fonts/Inter-italic.latin-ext.var.woff2
53
- - app/assets/fonts/Inter-italic.latin.var.woff2
54
- - app/assets/fonts/Inter-italic.symbols.var.woff2
55
- - app/assets/fonts/Inter-italic.vietnamese.var.woff2
56
- - app/assets/fonts/Inter-roman.alternates.var.woff2
57
- - app/assets/fonts/Inter-roman.cyrillic.var.woff2
58
- - app/assets/fonts/Inter-roman.extra.var.woff2
59
- - app/assets/fonts/Inter-roman.greek.var.woff2
60
- - app/assets/fonts/Inter-roman.latin-ext.var.woff2
61
- - app/assets/fonts/Inter-roman.latin.var.woff2
62
- - app/assets/fonts/Inter-roman.symbols.var.woff2
63
- - app/assets/fonts/Inter-roman.vietnamese.var.woff2
64
- - app/assets/stylesheets/inter-font.css
65
48
  - lib/generators/tailwindcss/authentication/authentication_generator.rb
66
49
  - lib/generators/tailwindcss/authentication/templates/app/views/passwords/edit.html.erb
67
50
  - lib/generators/tailwindcss/authentication/templates/app/views/passwords/new.html.erb
@@ -80,26 +63,40 @@ files:
80
63
  - lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt
81
64
  - lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt
82
65
  - lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt
66
+ - lib/generators/test_unit/scaffold/scaffold_generator.rb
83
67
  - lib/install/Procfile.dev
84
- - lib/install/application.tailwind.css
68
+ - lib/install/application.css
85
69
  - lib/install/dev
86
- - lib/install/tailwind.config.js
87
- - lib/install/tailwindcss.rb
70
+ - lib/install/install_tailwindcss.rb
71
+ - lib/install/upgrade_tailwindcss.rb
88
72
  - lib/puma/plugin/tailwindcss.rb
89
73
  - lib/tailwindcss-rails.rb
90
74
  - lib/tailwindcss/commands.rb
91
75
  - lib/tailwindcss/engine.rb
76
+ - lib/tailwindcss/engines.rb
92
77
  - lib/tailwindcss/upstream.rb
93
78
  - lib/tailwindcss/version.rb
94
79
  - lib/tasks/build.rake
95
80
  - lib/tasks/clobber.rake
96
81
  - lib/tasks/install.rake
82
+ - lib/tasks/upgrade.rake
97
83
  homepage: https://github.com/rails/tailwindcss-rails
98
84
  licenses:
99
85
  - MIT
100
86
  metadata:
101
87
  homepage_uri: https://github.com/rails/tailwindcss-rails
102
88
  rubygems_mfa_required: 'true'
89
+ post_install_message: |+
90
+ == Upgrading to Tailwind CSS v4 ==
91
+
92
+ If you are upgrading to tailwindcss-rails 4.x, please read the upgrade guide at:
93
+
94
+ https://github.com/rails/tailwindcss-rails/blob/main/README.md#upgrading-your-application-from-tailwind-v3-to-v4
95
+
96
+ If you're not ready to upgrade yet, please pin to version 3 in your Gemfile:
97
+
98
+ gem "tailwindcss-rails", "~> 3.3.1"
99
+
103
100
  rdoc_options: []
104
101
  require_paths:
105
102
  - lib
@@ -114,7 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
111
  - !ruby/object:Gem::Version
115
112
  version: 3.2.0
116
113
  requirements: []
117
- rubygems_version: 3.6.8
114
+ rubygems_version: 3.6.7
118
115
  specification_version: 4
119
116
  summary: Integrate Tailwind CSS with the asset pipeline in Rails.
120
117
  test_files: []
118
+ ...