Join GitHub today
JsRoutes do not re-compile when routes.rb changes #232
We have 2
However, what I've discovered is that when the routes change; the file does not get regenerated (unless it is removed from the sprockets cache). If I add any comments at the top of the
This seems like an order of operations issue; like sprockets is calculating the fingerprint / cache information of the file before ERB is changing the actual contents of the file.
I don't see a way to make that automatic.
The way we can change that is by passing asset name into generate manually:
<%= JsRoutes.generate(asset_name: 'admin_routes.js.erb', ... %>
It will help JsRoutes to add a dependency to expire the asset by updates in
The alternative way would be specify dependency yourself, but I don't know how to do that yet:
// = depend_on config/routes.rb <%= JsRoutes.generate %>
I will research for other ideas and post updates.