From dcd097326eaaed2e11f7a4a4445695e716672512 Mon Sep 17 00:00:00 2001 From: Dino Maric Date: Thu, 6 Jan 2022 21:39:50 +0100 Subject: [PATCH 1/7] Fix: Insert centering container around the yield (#106) Insertion point of the centering container was problematic. Meaning, if someone has a `yield :somethig` inside theirs `application.html.erb` old regex would pick that as a insertion point and possiblly break the html structure. This commit makes that regex more rigid to only insert centering container around the `<%= yield %>`. --- lib/install/tailwindcss.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/install/tailwindcss.rb b/lib/install/tailwindcss.rb index 7db9613f..0129d4e1 100644 --- a/lib/install/tailwindcss.rb +++ b/lib/install/tailwindcss.rb @@ -1,12 +1,14 @@ -APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb") +APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb") +CENTERING_CONTAINER_INSERTION_POINT = /^\s*<%= yield %>/.freeze if APPLICATION_LAYOUT_PATH.exist? say "Add Tailwindcss include tags and container element in application layout" insert_into_file APPLICATION_LAYOUT_PATH.to_s, <<~ERB.indent(4), before: /^\s*<%= stylesheet_link_tag/ <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %> ERB - insert_into_file APPLICATION_LAYOUT_PATH.to_s, %(
\n ), before: /^\s*<%= yield/ - insert_into_file APPLICATION_LAYOUT_PATH.to_s, %(\n
), after: /^\s*<%= yield %>/ + + insert_into_file APPLICATION_LAYOUT_PATH.to_s, %(
\n ), before: CENTERING_CONTAINER_INSERTION_POINT + insert_into_file APPLICATION_LAYOUT_PATH.to_s, %(\n
), after: CENTERING_CONTAINER_INSERTION_POINT else say "Default application.html.erb is missing!", :red say %( Add <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %> within the tag in your custom layout.) From 2b2a5ec39a18bf4f0204565489bc8d88f3b13473 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 6 Jan 2022 14:02:14 -0800 Subject: [PATCH 2/7] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6ab5aeb1..3e3b6247 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,9 @@ The `tailwindcss:build` is automatically attached to `assets:precompile`, so bef Tailwind uses modern CSS features that are not recognized by the `sassc-rails` extension that was included by default in the Gemfile for Rails 6. In order to avoid any errors like `SassC::SyntaxError`, you must remove that gem from your Gemfile. +## Class names must be spelled out + +For Tailwind to work, your class names need to be spelled out. They can't be programmatically composed. So no "text-gray-#{grade}", only "text-gray-500". ## Troubleshooting From b889dfc6407149018278fd0d01ad598bca74e5c8 Mon Sep 17 00:00:00 2001 From: Roland Studer Date: Sun, 9 Jan 2022 15:10:45 +0100 Subject: [PATCH 3/7] add description to watch task (#130) --- lib/tasks/build.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/build.rake b/lib/tasks/build.rake index 0ddcf057..886c847d 100644 --- a/lib/tasks/build.rake +++ b/lib/tasks/build.rake @@ -6,6 +6,7 @@ namespace :tailwindcss do system TAILWIND_COMPILE_COMMAND end + desc "Watch and build your Tailwind CSS on file changes" task :watch do system "#{TAILWIND_COMPILE_COMMAND} -w" end From 46ee2747f28a732c6c36e02224c66822eb9b9651 Mon Sep 17 00:00:00 2001 From: Dino Maric Date: Mon, 10 Jan 2022 11:59:29 +0100 Subject: [PATCH 4/7] Fix the wrong identation. (#132) --- lib/tailwindcss/engine.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tailwindcss/engine.rb b/lib/tailwindcss/engine.rb index 138a1508..4b9b9fdc 100644 --- a/lib/tailwindcss/engine.rb +++ b/lib/tailwindcss/engine.rb @@ -10,8 +10,8 @@ class Engine < ::Rails::Engine Rails.application.config.generators.stylesheets = false end - config.app_generators do |g| - g.template_engine :tailwindcss - end + config.app_generators do |g| + g.template_engine :tailwindcss + end end end From ad384c73fc49879f497f9b5b9dcd349858d052b2 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 16 Jan 2022 10:59:07 +0100 Subject: [PATCH 5/7] Upgrade to Tailwind CSS v3.0.15 --- lib/tailwindcss/upstream.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tailwindcss/upstream.rb b/lib/tailwindcss/upstream.rb index 757f8403..f4d063f9 100644 --- a/lib/tailwindcss/upstream.rb +++ b/lib/tailwindcss/upstream.rb @@ -1,7 +1,7 @@ module Tailwindcss # constants describing the upstream tailwindcss project module Upstream - VERSION = "v3.0.8" + VERSION = "v3.0.15" # rubygems platform name => upstream release filename NATIVE_PLATFORMS = { From b5b9f5f301c26a6bd92c151026623ef375dae962 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 16 Jan 2022 10:59:42 +0100 Subject: [PATCH 6/7] Bump for v2.0.5 --- lib/tailwindcss/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tailwindcss/version.rb b/lib/tailwindcss/version.rb index fc85cd6f..87e905d8 100644 --- a/lib/tailwindcss/version.rb +++ b/lib/tailwindcss/version.rb @@ -1,3 +1,3 @@ module Tailwindcss - VERSION = "2.0.4" + VERSION = "2.0.5" end From 9c49c86e1b8a07a7eb8e09872d3f1d6da597ff66 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 16 Jan 2022 11:00:24 +0100 Subject: [PATCH 7/7] Bump version for 2.0.5 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f5e79311..2bb237fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - tailwindcss-rails (2.0.4) + tailwindcss-rails (2.0.5) railties (>= 6.0.0) GEM