I am building a web application with CodeIgniter at the back and Backbone / RequireJS at the front. Thus, this is not a one-page web application, but rather uses CI for many controller actions and Backbone for different views at different times. I have a RequireJS / Backbone installation, for example:
<script type="text/javascript" data-main="main" src="require.js"></script>
main.js is as follows:
require.config({
paths: {
jquery: "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min",
underscore: "libs/underscore",
backbone: "libs/backbone",
},
shim: {
backbone: {
deps: ["underscore", "jquery"],
}
}
});
require(['views/app'], function(AppView){
var app_view = new AppView;
});
Main.js is loaded into my main template, i.e. on each page, and, in turn, loads a bunch of views that are common to the site / application headings, navigators, etc.
But on different pages, I also want to load different views in addition to the general ones. So, for example, on a page called "publish" - almost an application in itself - I:
<script type="text/javascript" src="publish.js"></script>
main.js :
require(['views/publishview], function(PublishView){
var publishView = new PublishView;
});
, , ( ), 404 .
, , ? , , SPA, CodeIgniter.
, .