Closed aviemet closed 2 years ago
Yes, use file
configuration option: https://github.com/railsware/js-routes#generator-options
Thank you for pointing that out. I'm still having issues setting the output path, it seems that changes can only be made relative to app/javascript
. I believe this is the location where that limitation is set: https://github.com/railsware/js-routes/blob/e158c58fabcb8584f86d8d8c5b03b85729578c14/lib/js_routes/configuration.rb#L77
All of the following configurations resulted in an error:
config.file = 'app/frontend/routes'
# app/javascript/app/frontend/routes isn't a file
config.file = Rails.root.join('app', 'frontend', 'routes')
# app/javascript/var/project/app/frontend/routes isn't a file
config.file = 'app/frontend/routes/routes.js'
# app/javascript/app/frontend/routes doesn't exist
config.file = Rails.root.join('app', 'frontend', 'routes', 'routes.js')
# app/javascript/var/project/app/frontend/routes doesn't exist
The closest I've gotten was using config.file = '../frontend/routes/routes.js'
, however this produced strange results. It generated the d.ts
file in the specified path, but the routes.js
file still generated in app/javascript
.
In your last example: does app/frontend/routes
directory exist? Can you make it and see if it fixes the issue?
Yes, the directory existed and routes.d.ts
generated there, but routes.js
was placed in app/javascript
, which also existed.
I can confirm this (js-routes 2.2.1). Last version it worked is 2.0.8
Fixed in 2.2.2 👍
Fixed in 2.2.2 +1
Can confirm it's working. I had just updated to 2.2.1 from 1.4.x and was trying to find the problem. Thank you very much @bogdan .
This is still not working (app/assets/javascripts/) exists within my rails app: config/initializers/js_routes.rb: JsRoutes.setup do |c| c.module_type = nil c.namespace = 'Routes' c.prefix = Figaro.env.url_prefix c.file = 'app/assets/javascripts/routes.js' end
rake js:routes Errno::ENOENT: No such file or directory @ rb_sysopen - PATH/app/javascript/app/assets/javascripts/routes.js
Forgive me if this is documented, but I can't seem to figure out how to change the output path for the generated routes files. Using Rails 7 with Vite, I keep my frontend code in
app/frontend
, and so would like this gem to output routes to that directory. I would actually like them to be placed in a folder inside that directory. Is this currently possible?