Skip to content

Commit

Permalink
Prefer dependency on javascript:build over assets:precompile.
Browse files Browse the repository at this point in the history
Whenever jsbundling-rails is used, it is better to extend
javascript:build instead of assets:precompile. See #305.
  • Loading branch information
bogdan committed Jul 5, 2023
1 parent cae5557 commit 2acebc8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/js_routes/generators/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ def middleware_content
end

def rakefile_content
enhanced_task = Bundler.load.gems.find {|g| g.name = 'jsbundling-rails'} ?
"javascript:build" : "assets:precompile"
<<-RB
# Update js-routes file before assets precompile
namespace :assets do
task precompile: "js:routes:typescript"
end
# Update js-routes file before javascript build
task "#{enhanced_task}" => "js:routes:typescript"
RB
end

Expand Down

0 comments on commit 2acebc8

Please sign in to comment.