Skip to content

Commit

Permalink
2.4.0 This script is become more and more powerful!
Browse files Browse the repository at this point in the history
  • Loading branch information
palladius committed Jan 3, 2024
1 parent c438cc1 commit 8d843ac
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bin/rails-which-javascript-env
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,38 @@ def check_for_rails_folder_or_die
raise "Not a Rails app!" unless ret
end

def check_for_css_frameworks
puts "🕴️ CSS Checks"
%w{ tailwind bootstrap }.each do |framework|
# 1. Look in layouts
ret = `grep '#{framework}' 'app/views/layouts/application.html.erb'`
if $? == 0
puts "✅ Found in app/views/layouts/application.html.erb: #{framework}"
#puts ret
end
# 2. Look in JS:
ret = `grep -r '#{framework}' 'app/javascript/'`
if $? == 0
puts "✅ Found in app/javascript/: #{framework}"
#puts ret
end
# 3. Look in CSS:
ret = `grep -r '#{framework}' 'app/assets/stylesheets/'`
if $? == 0
puts "✅ Found in app/assets/stylesheets/: #{framework}"
#puts ret
end
end
end

def main
puts '1. Lets see if you are in a rails project'
check_for_rails_folder_or_die
puts '🟥❤️♥️ 🚅 Yes!'
puts '2. Lets see if you are using a framework'
check_for_all_frameworks
looks_like_all_frameworks
check_for_css_frameworks
puts 'The end (thanks Bard)'
end

Expand Down

0 comments on commit 8d843ac

Please sign in to comment.