Skip to content

Commit

Permalink
Install as Puma plugin if available
Browse files Browse the repository at this point in the history
  • Loading branch information
javierav committed Feb 8, 2024
1 parent 1555a49 commit 9b67b6e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions lib/install/tailwindcss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,24 @@
copy_file "#{__dir__}/application.tailwind.css", "app/assets/stylesheets/application.tailwind.css"
end

if Rails.root.join("Procfile.dev").exist?
append_to_file "Procfile.dev", "css: bin/rails tailwindcss:watch\n"
if Rails.root.join("config/puma.rb").exist?
say "Add tailwindcss as Puma plugin"
append_to_file "config/puma.rb", "\nplugin :tailwindcss if ENV.fetch(\"RAILS_ENV\", \"development\") == \"development\"\n"
else
say "Add default Procfile.dev"
copy_file "#{__dir__}/Procfile.dev", "Procfile.dev"
if Rails.root.join("Procfile.dev").exist?
append_to_file "Procfile.dev", "css: bin/rails tailwindcss:watch\n"
else
say "Add default Procfile.dev"
copy_file "#{__dir__}/Procfile.dev", "Procfile.dev"

say "Ensure foreman is installed"
run "gem install foreman"
end

say "Ensure foreman is installed"
run "gem install foreman"
say "Add bin/dev to start foreman"
copy_file "#{__dir__}/dev", "bin/dev"
chmod "bin/dev", 0755, verbose: false
end

say "Add bin/dev to start foreman"
copy_file "#{__dir__}/dev", "bin/dev"
chmod "bin/dev", 0755, verbose: false

say "Compile initial Tailwind build"
run "rails tailwindcss:build"

0 comments on commit 9b67b6e

Please sign in to comment.