From 9d0f5bac1270c7768409718c3b7ba6d985f724a8 Mon Sep 17 00:00:00 2001 From: pvincent Date: Thu, 1 Jun 2023 10:30:04 +0400 Subject: [PATCH] fix tailwind issue with rails assets:clobber --- Gemfile | 8 ++++--- Gemfile.lock | 22 +++++++++++++++---- .../stylesheets/application.tailwind.css | 1 - app/javascript/application.js | 4 ---- app/views/layouts/application.html.erb | 8 ++++--- app/views/main/about.html.erb | 9 ++++++-- app/views/main/home.html.erb | 17 +++++++------- app/views/main/index.html.erb | 10 +++++++++ config/application.rb | 22 ++++++++++--------- config/credentials.yml.enc | 2 +- config/routes.rb | 1 - 11 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 app/views/main/index.html.erb diff --git a/Gemfile b/Gemfile index e8df00e..788ee30 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "3.1.4" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" -gem "rails", "~> 7.0.4", ">= 7.0.4.3" +gem "rails", "~> 7.0.5" # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] gem "sprockets-rails" @@ -24,6 +24,9 @@ gem "turbo-rails" # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] gem "stimulus-rails" +# Use Tailwind CSS [https://github.com/rails/tailwindcss-rails] +gem "tailwindcss-rails" + # Build JSON APIs with ease [https://github.com/rails/jbuilder] gem "jbuilder" @@ -66,6 +69,7 @@ group :development do # Speed up commands on slow machines / big apps [https://github.com/rails/spring] # gem "spring" + gem "rails_live_reload" end group :test do @@ -74,5 +78,3 @@ group :test do gem "selenium-webdriver" gem "webdrivers" end - -gem "tailwindcss-rails", "~> 2.0" diff --git a/Gemfile.lock b/Gemfile.lock index b32e741..4814df6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,6 +89,7 @@ GEM irb (>= 1.5.0) reline (>= 0.3.1) erubi (1.12.0) + ffi (1.15.5) globalid (1.1.0) activesupport (>= 5.0) i18n (1.13.0) @@ -102,6 +103,9 @@ GEM jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) + listen (3.8.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) loofah (2.21.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -152,8 +156,14 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + rails_live_reload (0.3.4) + listen + nio4r + railties + websocket-driver rails_semantic_logger (4.12.0) rack railties (>= 5.1) @@ -166,6 +176,9 @@ GEM thor (~> 1.0) zeitwerk (~> 2.5) rake (13.0.6) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) regexp_parser (2.8.0) reline (0.3.4) io-console (~> 0.5) @@ -225,13 +238,14 @@ DEPENDENCIES importmap-rails jbuilder puma (~> 5.0) - rails (~> 7.0.4, >= 7.0.4.3) + rails (~> 7.0.5) + rails_live_reload rails_semantic_logger selenium-webdriver sprockets-rails sqlite3 (~> 1.4) stimulus-rails - tailwindcss-rails (~> 2.0) + tailwindcss-rails turbo-rails tzinfo-data web-console diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index 1b66ae9..c1bead4 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -7,4 +7,3 @@ @apply py-2 px-4 bg-blue-200; } } - diff --git a/app/javascript/application.js b/app/javascript/application.js index 7910a2e..0d7b494 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,7 +1,3 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@hotwired/turbo-rails" import "controllers" - -// The two following lines disable Turbo on the whole application -// import { Turbo } from "@hotwired/turbo-rails" -// Turbo.session.drive = false diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index fc13620..5f59981 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -9,11 +9,13 @@ <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> <%= javascript_importmap_tags %> - + - <%= yield %> +
+ <%= yield %> +
diff --git a/app/views/main/about.html.erb b/app/views/main/about.html.erb index cd51748..453a293 100644 --- a/app/views/main/about.html.erb +++ b/app/views/main/about.html.erb @@ -1,2 +1,7 @@ -

Main#about

-This page takes a while to complete +
+

Main#index

+

aaaaaaaaaaaaaa

+

aaaaaasaaa

+

Find me in app/views/main/index.html.erb

+ ABOUT 3 +
diff --git a/app/views/main/home.html.erb b/app/views/main/home.html.erb index 3faa92a..98ac5c9 100644 --- a/app/views/main/home.html.erb +++ b/app/views/main/home.html.erb @@ -1,11 +1,10 @@ -
-

Main#home

-

Find me in app/views/main/home.html.erb

-

- Hello world! -

-
- coucou - <%= @value %> +
+
+

Main#index

+

Find me in app/views/main/index.html.erb

+
+ this is index +
+ pipipaaaa
diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb new file mode 100644 index 0000000..0b255f7 --- /dev/null +++ b/app/views/main/index.html.erb @@ -0,0 +1,10 @@ +
+
+

Main#index

+

Find me in app/views/main/index.html.erb

+
+ this is index +
+ pipip +
+
diff --git a/config/application.rb b/config/application.rb index fd6797c..cd1c4f7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -6,15 +6,17 @@ require "rails/all" # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) -class Application < Rails::Application - # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.0 +module Blog + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 7.0 - # Efficient logging with Semantic Logger - require Rails.root.join("lib", "formatters", "basic_formatter") - config.rails_semantic_logger.add_file_appender = false - config.rails_semantic_logger.semantic = false - config.rails_semantic_logger.started = true - config.rails_semantic_logger.processing = true - config.rails_semantic_logger.rendered = true + # Efficient logging with Semantic Logger + require Rails.root.join("lib", "formatters", "basic_formatter") + config.rails_semantic_logger.add_file_appender = false + config.rails_semantic_logger.semantic = false + config.rails_semantic_logger.started = true + config.rails_semantic_logger.processing = true + config.rails_semantic_logger.rendered = true + end end diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index 97e8c48..e581996 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -5C1qSkbpL3Ob1EMxtbSq5Uh5fCt4FUnhDKavga1clTQIyOb1wpigr549KL2ZAHgkLZi/zkcvI9+P2VSzZsZRr4/Ee0OE1Uw/HUTGpCEM6HgcdP8mknaiM1tic66Ib/Y1u1TyilqQw74n/05Sa4nc2KG3iSwcRejcRduQTZPujcqRWTurCi7+39GfLO2pNWDcWhS/j3JgmXUg1CUQyKeAasDIVRHCyKq15t4HRHMfiHI0MmA4HUudOdEdP8iRqhfENtzqRgk94lFc7XUMcrIA++Vs+NOPSXbo+MLezLp0kGqQt9JMdDm+xZlbBaZUJdWBxfKFtMWRmb18MwwPSqZiF90niCmAK/kt2mIDZVZdIEKsiASXREJTrXTLvWhZu0R28+KLMmFO41NKzR7rnOOjL23nbWtIvixgw2MY--7Lu0otgpXegPds+U--MkdXaQCI+h8z/lb8ZHShWg== \ No newline at end of file +iB7ToBS4ntk66axC4o2M+yH9+IKwtOEHfyPCRXD5rAbF6XArsc3fyMAATar9dDe+buQRL/TcDAPHhuq6cJNaEKdhMogC+QvMfgUM3FaWzK2E7WhSnMa+D4uYtpmzeX3qPPw1L6m+0M0TRck+IT2A22rwbGT85WkQfGJLCnxvS54nhTRFsK6JY87R45ExfDaCWYypf9mfdoxENJMExLf5WEIoDFqzO9jf8Dek97442WBzDivqqSMKgkVU8oOYDCufSDBQXRAGpn8KQT9omg7SUbm9joZBRH7zjin0DMSvT/9pNGhKE5YP2NOlTuKWUKXpcjCrkyc0s5Zi5G/XnzIfeArPqEaI3qlUD4SWXZIEOigLsKKBfJJTrnRnq0igPtWdn27e2I0Zw3flEcCeI8dOsK3hyDy34qsAXlnq--o/3RXuq/T5OmfCIN--JLllcBMzauguUvUJs5/18g== \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 25a7937..a1ffd2f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,4 @@ Rails.application.routes.draw do root "main#home" - get "main/about" end