Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install as Puma plugin if available #331

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading