On Sun, Jul 26, 2009 at 12:06:11PM +0200, Jakub Narebski wrote: > On Sat, 25 Jul 2009, Martin Koegler wrote: > > On Sat, Jul 25, 2009 at 12:44:10AM +0200, Jakub Narebski wrote: > > > > TODO list: > > > * Perhaps put fixLinks() function in separate file gitweb.js. > > > Should gitweb use single JavaScript file, or should it be split into > > > more than one file? > > > > The same question can be asked for gitweb itself: > > Well, there is one important difference: gitweb itself is not send > over network to client. JavaScript is. (Although I'm not sure how > great it is of an issue, with browsers caching JavaScript. Perhaps > one single file would be better idea.) More files mean more request on the server. If the browser is configured to check at each request, it will issue a GET for each JavaScript file, which will be answered by a 304 after the first request. In the "automatic mode", the browser waits for some time (determined by a heuristic), before it will issue a GET for each file request again. So in my option, on (bigger) file is better, as it means fewer request. > > > > Why is it a single perl file and not splited in many different > > modules? > > 2. Having it all in single file make its easy to install and update. > Well, it made more sense when only way to configure gitweb was to > edit gitweb.cgi. Now building gitweb.cgi is the task for build > system, and the only thing left is to copy files in correct place > (I think that there are distribution specific packages which makes > installing gitweb as easy as "xxx install gitweb"). Yes, there are gitweb packages, which automaticially server repositories under a specific path (eg. /srv/git). For such packages, the js layout is irrelavant. When manually installing, copying only one javascript file simplifies the deployment. > 3. You would have to decide _how_ to split it into many different > modules. Do you know any good examples? Javascript uses on global namespace. If it is one file, its implicitly clear, that everything (functions, variables) are in one scope. If you split it into multiple files, you have to remember, what the other files contain. mfg Martin Kögler -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html