Browse Source

fix tailwind issue with rails assets:clobber

main
pvincent 1 year ago
parent
commit
9d0f5bac12
  1. 8
      Gemfile
  2. 22
      Gemfile.lock
  3. 1
      app/assets/stylesheets/application.tailwind.css
  4. 4
      app/javascript/application.js
  5. 6
      app/views/layouts/application.html.erb
  6. 9
      app/views/main/about.html.erb
  7. 17
      app/views/main/home.html.erb
  8. 10
      app/views/main/index.html.erb
  9. 4
      config/application.rb
  10. 2
      config/credentials.yml.enc
  11. 1
      config/routes.rb

8
Gemfile

@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.4" ruby "3.1.4"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" # 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] # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails" gem "sprockets-rails"
@ -24,6 +24,9 @@ gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails" 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] # Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder" gem "jbuilder"
@ -66,6 +69,7 @@ group :development do
# Speed up commands on slow machines / big apps [https://github.com/rails/spring] # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring" # gem "spring"
gem "rails_live_reload"
end end
group :test do group :test do
@ -74,5 +78,3 @@ group :test do
gem "selenium-webdriver" gem "selenium-webdriver"
gem "webdrivers" gem "webdrivers"
end end
gem "tailwindcss-rails", "~> 2.0"

22
Gemfile.lock

@ -89,6 +89,7 @@ GEM
irb (>= 1.5.0) irb (>= 1.5.0)
reline (>= 0.3.1) reline (>= 0.3.1)
erubi (1.12.0) erubi (1.12.0)
ffi (1.15.5)
globalid (1.1.0) globalid (1.1.0)
activesupport (>= 5.0) activesupport (>= 5.0)
i18n (1.13.0) i18n (1.13.0)
@ -102,6 +103,9 @@ GEM
jbuilder (2.11.5) jbuilder (2.11.5)
actionview (>= 5.0.0) actionview (>= 5.0.0)
activesupport (>= 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) loofah (2.21.3)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.12.0) nokogiri (>= 1.12.0)
@ -152,8 +156,14 @@ GEM
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) 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) rails_semantic_logger (4.12.0)
rack rack
railties (>= 5.1) railties (>= 5.1)
@ -166,6 +176,9 @@ GEM
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5) zeitwerk (~> 2.5)
rake (13.0.6) rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (2.8.0) regexp_parser (2.8.0)
reline (0.3.4) reline (0.3.4)
io-console (~> 0.5) io-console (~> 0.5)
@ -225,13 +238,14 @@ DEPENDENCIES
importmap-rails importmap-rails
jbuilder jbuilder
puma (~> 5.0) puma (~> 5.0)
rails (~> 7.0.4, >= 7.0.4.3)
rails (~> 7.0.5)
rails_live_reload
rails_semantic_logger rails_semantic_logger
selenium-webdriver selenium-webdriver
sprockets-rails sprockets-rails
sqlite3 (~> 1.4) sqlite3 (~> 1.4)
stimulus-rails stimulus-rails
tailwindcss-rails (~> 2.0)
tailwindcss-rails
turbo-rails turbo-rails
tzinfo-data tzinfo-data
web-console web-console

1
app/assets/stylesheets/application.tailwind.css

@ -7,4 +7,3 @@
@apply py-2 px-4 bg-blue-200; @apply py-2 px-4 bg-blue-200;
} }
} }

4
app/javascript/application.js

@ -1,7 +1,3 @@
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
import "@hotwired/turbo-rails" import "@hotwired/turbo-rails"
import "controllers" import "controllers"
// The two following lines disable Turbo on the whole application
// import { Turbo } from "@hotwired/turbo-rails"
// Turbo.session.drive = false

6
app/views/layouts/application.html.erb

@ -9,11 +9,13 @@
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %> <%= javascript_importmap_tags %>
</head> </head>
<body>
<body class='bg-yellow-200'>
<nav > <nav >
<%= link_to 'home', :root %>
<%= link_to 'home', :root, class: 'btn-primary' %>
<%= link_to 'about', main_about_path %> <%= link_to 'about', main_about_path %>
</nav> </nav>
<div>
<%= yield %> <%= yield %>
</div>
</body> </body>
</html> </html>

9
app/views/main/about.html.erb

@ -1,2 +1,7 @@
<h1>Main#about</h1>
This page takes a while to complete
<div>
<h1 class="text-2xl text-red-300 ">Main#index</h1>
<h2 class="text-3xl">aaaaaaaaaaaaaa</h2>
<h1 class="text-3xl font-bold text-gray-700">aaaaaasaaa</h1>
<p class=" text-4xl center bg-red-700 text-blue-800">Find me in app/views/main/index.html.erb</p>
ABOUT 3
</div>

17
app/views/main/home.html.erb

@ -1,11 +1,10 @@
<div class="p-5">
<h1>Main#home</h1>
<p>Find me in app/views/main/home.html.erb</p>
<h1 class="text-5xl font-bold underline text-yellow-400">
Hello world!
</h1>
<div class="bg-orange-300">
coucou
<%= @value %>
<div>
<div class="flex">
<h1 class="font-bold text-2xl ">Main#index</h1>
<p class=" text-4xl center bg-red-300 text-blue-800">Find me in app/views/main/index.html.erb</p>
</div>
this is index
<div class="text-pink-700 font-bold text-2xl">
pipipaaaa
</div> </div>
</div> </div>

10
app/views/main/index.html.erb

@ -0,0 +1,10 @@
<div>
<div class="flex">
<h1 class="font-bold text-2xl ">Main#index</h1>
<p class=" text-4xl center bg-red-300 text-blue-800">Find me in app/views/main/index.html.erb</p>
</div>
this is index
<div class="text-pink-700 font-bold text-2xl">
pipip
</div>
</div>

4
config/application.rb

@ -6,7 +6,8 @@ require "rails/all"
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups) Bundler.require(*Rails.groups)
class Application < Rails::Application
module Blog
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0 config.load_defaults 7.0
@ -17,4 +18,5 @@ class Application < Rails::Application
config.rails_semantic_logger.started = true config.rails_semantic_logger.started = true
config.rails_semantic_logger.processing = true config.rails_semantic_logger.processing = true
config.rails_semantic_logger.rendered = true config.rails_semantic_logger.rendered = true
end
end end

2
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==
iB7ToBS4ntk66axC4o2M+yH9+IKwtOEHfyPCRXD5rAbF6XArsc3fyMAATar9dDe+buQRL/TcDAPHhuq6cJNaEKdhMogC+QvMfgUM3FaWzK2E7WhSnMa+D4uYtpmzeX3qPPw1L6m+0M0TRck+IT2A22rwbGT85WkQfGJLCnxvS54nhTRFsK6JY87R45ExfDaCWYypf9mfdoxENJMExLf5WEIoDFqzO9jf8Dek97442WBzDivqqSMKgkVU8oOYDCufSDBQXRAGpn8KQT9omg7SUbm9joZBRH7zjin0DMSvT/9pNGhKE5YP2NOlTuKWUKXpcjCrkyc0s5Zi5G/XnzIfeArPqEaI3qlUD4SWXZIEOigLsKKBfJJTrnRnq0igPtWdn27e2I0Zw3flEcCeI8dOsK3hyDy34qsAXlnq--o/3RXuq/T5OmfCIN--JLllcBMzauguUvUJs5/18g==

1
config/routes.rb

@ -1,5 +1,4 @@
Rails.application.routes.draw do Rails.application.routes.draw do
root "main#home" root "main#home"
get "main/about" get "main/about"
end end
Loading…
Cancel
Save