Pregunta

I am a noob to RequireJS. I'm using it with jQuery and jQuery UI for now. I have a login page and a main app page. Most of the examples show some type of app.main(); that kicks off the application. I don't want my login page to load up the whole application. What is the best way to do this? Right now, I have two configurations and two data-main script clauses, one for login and one for my index.

Now, I realize I could have put the login/register script in the main part of the app, but I still don't even want to point at the JS until you are registered.

Am I going about this the wrong way? I already am using a MVC framework in Perl, so I'd rather not put an additional MVC framework on top of that (like backbone.js)

Thanks

¿Fue útil?

Solución

I missed this multi page example from requirejs.org, which appears to be what I want. Indeed, I'll need different data-main's and different config files in each applicable file. I should have a common module file, then specific files that load the common module and their own dependencies. From there, the optimizer can make life easier.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top