Closed mkroetzsch closed 8 years ago
I pushed my progress with this in the branch refactor. The changes are documented in the file refactor.documentation there.
Problem with my approach is that we get circular dependencies. Example: <squid-footer /> directive in index.html is defined in util/directives. To have it parsed, app/app should depend on util/directives, but that depends on app/statistics which depends on app/app. I assume the best workaround here is making statistics part of the util module. I'm just saying that we can expect more cases like this to occur (I don't have everything completely sorted out yet).
My general concern is to over-complicate things here. On the one hand we now have two steps of handling dependencies (requirejs and angular), on the other hand dependencies can be quite non-obvious, since they can hide in template files or similar. And for example an unknown directive is just silently ignored and doesn't give a good indication that something is wrong.
Apart from that I think that the project becomes a lot more maintainable when split into smaller chunks like this.
Nevermind I found a solution that seems to work quite well. It's just that the whole dependency management seems a little semantically obscure. The following snippet illustrates it somewhat:
// Load everything, start the app
requirejs([
'jquery-ui',
'app/browse', // everything else
'app/view', // is implicitly
'app/translate', // pulled via
'util/directives', // dependencies
'query/query'
], function() {
jQuery(function() {
angular.bootstrap( document, ['classBrowserApp'], { strictDi: true } );
});
});`
See #66
Done. Further improvements are discussed in #67
We should have one file per module rather than the long JavaScript files with many modules we have now. The files can be compiled and minified for deployment to ensure efficient loading nonetheless. This is a critical blocker for having further people contribute to the code and for moving on with own developments.
(@guenthermi @arsylum tracking here what we discussed in email; let's have related discussions on this thread)