I am learning Durandal 2 in the hopes of converting my CMS' admin backend into an SPA. I managed to get Durandal to work with the MVC routes and all, but there's one big hiccup I have run into which may be a showstopper here.
I have a plugin architecture, something as follows:
Main CMS Project
- Lib 1
- Lib 2
- etc...
- Plugins Folder
- Plugin 1
- Plugin 2
- Plugin 3
- etc...
I am thinking I can easily grab the routes from MVC via something like System.Web.Routing.RouteTable.Routes
. Then I would send that to Durandal via a controller action in the form of JSON and pass it to router.map()
. That sounds good in theory. However, there is one very big issue here and that is Durandal seems to expect that every route MUST have a script associated with it (one .js
file and one .html
file by default).
The obvious issue here is for this to work, I would need to have ALL of the scripts from the different plugins inside my main project, example:
Main CMS Project
- App
- viewmodels
- admin
- pages
pages.js
- blog
blog.js
Something like that I suppose. Where pages and blog may be in a different library or plugin along with various other routes. This is of course impossible. Is there either some way to modify the location of some of the scripts or some way to have ONLY html
without the .js
files in some cases? With the latter, I could manually load whatever .js
files I wanted to in the .cshtml files.