Skip to content

Commit 52daa95

Browse files
Conditionally generate assets during setup
Clobber and precompile assets during setup if using [Sprockets][]. This is helpful in cases where one might switch branches frequently, which can result in broken assets. [Sprockets]: https://github.com/rails/sprockets
1 parent d283063 commit 52daa95

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/generators/templates/setup/bin_setup.rb

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ def using_node?
4343
puts "\n== Preparing database and adding development seed data =="
4444
system! "bin/rails dev:prime"
4545

46+
if Rake::Task.task_defined?("assets:clobber") && Rake::Task.task_defined("assets:precompile")
47+
puts "\n== Generating assets =="
48+
system! "bin/rails assets:clobber assets:precompile"
49+
end
50+
4651
# https://github.com/rails/rails/pull/47719/files
4752
puts "\n== Setup test environment =="
4853
system! "bin/rails test:prepare"

0 commit comments

Comments
 (0)