GithubHelp home page GithubHelp logo

Custom output path about js-routes HOT 8 CLOSED

aviemet avatar aviemet commented on September 27, 2024
Custom output path

from js-routes.

Comments (8)

bogdan avatar bogdan commented on September 27, 2024

Yes, use file configuration option: https://github.com/railsware/js-routes#generator-options

from js-routes.

aviemet avatar aviemet commented on September 27, 2024

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:

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.

from js-routes.

bogdan avatar bogdan commented on September 27, 2024

In your last example: does app/frontend/routes directory exist? Can you make it and see if it fixes the issue?

from js-routes.

aviemet avatar aviemet commented on September 27, 2024

Yes, the directory existed and routes.d.ts generated there, but routes.js was placed in app/javascript, which also existed.

from js-routes.

beeforever avatar beeforever commented on September 27, 2024

I can confirm this (js-routes 2.2.1). Last version it worked is 2.0.8

from js-routes.

bogdan avatar bogdan commented on September 27, 2024

Fixed in 2.2.2 👍

from js-routes.

GabrielErbetta avatar GabrielErbetta commented on September 27, 2024

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 .

from js-routes.

beeforever avatar beeforever commented on September 27, 2024

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

from js-routes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.