Back to Template

Diff of Changes

Previous version at this commit

if !defined?(Webpacker)
  puts_red "Webpacker was not installed. Adding it now..."
  run "bundle add webpacker"
end

gem "tailwindcss"

run "bundle install"
run "bundle exec rails g tailwindcss:install"

injection_target = '# Rails.application.config.content_security_policy_report_only = true'

inject_into_file 'config/initializers/content_security_policy.rb', after: injection_target + "\n" do <<~EOF
Rails.application.config.content_security_policy do |policy|
  policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
end
  EOF
end

gsub_file 'config/webpacker.yml', 'extract_css: false', 'extract_css: true'

inject_into_file 'app/views/layouts/application.html.erb', after: "<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>" + "\n" do <<~EOF
    <%= stylesheet_pack_tag 'application' %>
  EOF
end