javascript - Setting data-main for multiple html files in requirejs -
i building simple project has below modules.
- login page (html)
- register page(html)
- main page(html)
since in modules,i have chosen requirejs task plus it's module loading capability.
i wanted know, if there 3 html files in project, there 3 data-main, mean 3 main files have configuration.
is there way have single main file or need have 1 html file, shows 1 functionality(i.e. login or register or main page) @ time. 1 approach or practice. new requirejs. in advance.
if building multi-page application each page need load requirejs , have data-main. reason being going new page no longer have files loaded , lose it's memory.
more common nowadays build single-page application hash routing. when using requirejs kind of app in mind. can have 1 index.html file load templates based on you're trying display (login/register/main). routing library routie (http://projects.jga.me/routie/) , others handle changing hash in address bar.
if take single page application route, suggest using framework knockoutjs, backbonejs, angularjs, ember.js... of these of heavy lifting.
Comments
Post a Comment