4

Currently I'm working on a big project which tends to have about 10000 javascript and cshtml files.

It's a good idea to have a shell project, and lots of business projects like:

MyCompany.Shell
MyCompany.BusinessDomain1
MyCompany.BusinessDomain2

in this way, MyCompany.Shell is a Web project, and the others are Class Libraries. How can I configure my Solution, TeamProject and MyCompany.Shell to use the JavaScript files which are spread over the Business projects.

FYI, I'm using HotTowel template and Durandal 2.0.1

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
mehrandvd
  • 8,806
  • 12
  • 64
  • 111

1 Answers1

1

If you're using MVC to generate the views, there's not really a way to do that, because you'd have different web sites. Unless you deploy them into virtual directories, durandal can't get to the views. If you are deploying them into virtual directories then you just have to ensure that the paths to your views and viewmodels are correct at runtime.

Apart from that here are a few tips that maybe useful:

  • I think a single Durandal app with 10000 JS files is probably a bit over the top. In my opinion you'd be better of to partition you project into separate sub applications.
  • I wouldn't use MVC to render your views. I tried going that way once but it ends up in a mess. You'd be better of to keep your HTML static and do all the dynamic parts through a (JSON)API and a your viewmodels.
  • I wouldn't put my JS files together with my Business-projects (or domain logic FTM). What you want is a clean separation between what lives on the server and on the client. The separation should come from an API in the middle. That way you can evolve client and server side separately
Kenneth
  • 28,294
  • 6
  • 61
  • 84
  • The fact is each user is not facing all of these javascript fiels. for example a financial user use cases may lead to load about 100 javascript at most. And another logistics user my lead to load another 100 javascripts set. In the windows desktop application, all of these are separated into different modules using SCSF and CAB. So in the web I'm trying to separate js files just like the way in desktop application(Business domain by business domain) – mehrandvd Dec 10 '13 at 12:17
  • That's why I said it may be better to partition your application. You could still build some common modules together with every app (just use the correct routes or add the files as a link into your project). – Kenneth Dec 10 '13 at 13:13