Skip to content
OnkelHenky edited this page Feb 18, 2011 · 3 revisions

Task Merge

The mission of the merge task is to combine the JavaScript files of framework into one single file. The reason for this is to shrink down the amount of files, that has to be send to the client. The implementation of the merge task is very plain.

The following diagramm shows the generation of a combined JavaScript out put file.

After combining the alle JavaScript file sof a framework, the content is bound to a new File object, containing the combined content. This new File object is save in the Files arrays of the Framework, overriding all singel files. See also source code snippet below:

Task_Merge.prototype.duty = function(framework,callback){
var mergedFile;
var combinedFiles = [];

  framework.files.forEach(function(file){
       if(file.isJavaScript()){
          mergedFile += file.content;
        } 
  });

  
combinedFiles.push( new File({
                             frDelimiter: framework.frDelimiter,
                             name: framework.name,
                             path: framework.name+'.js',
                             containsMergedContent : true,
                             framework: framework,
                             content: mergedFile
                            })
                   );
 framework.files = combinedFiles;
 callback(framework);
}
Clone this wiki locally