I just pluck out the javascript require call from nested-template.
Require.js Backbone modular architecture for r.js
-
26-06-2023 - |
Frage
my_todo_app.html has
- todo_header.html
- todo_body.html
- todo_footer.html
The htmls above are rendered server-side.
todo_header.html creates HeaderView like below(and the two other htmls create their corresponding Backbone Views as well)
<div id='header-view'>
.. other html contents that are rendered in server-side
</div>
require([header_view], function(HeaderView) {
var headerView = new HeaderView({el: "#header-view");
});
Is this bad practice?
I'd like to concatenate javascript files for the todo app using r.js and stuck.
Because r.js concatenates files by looking at the dependancy, and I don't have a file that states todo app depends on HeaderView/BodyView/FooterView.
Should I not separate server-side htmls at all?
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow