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 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 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.) 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 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 = { 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 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