docs: function (fileName, fileContents, outFileName, config, pluginCollector) {
              var optFunc, optConfig,
                  parts = (String(config.optimize)).split('.'),
                  optimizerName = parts[0],
                  keepLines = parts[1] === 'keepLines',
                  licenseContents = '';
  
              config = config || {};
  
              //Apply pragmas/namespace renaming
              fileContents = pragma.process(fileName, fileContents, config, 'OnSave', pluginCollector);
  
              //Optimize the JS files if asked.
              if (optimizerName && optimizerName !== 'none') {
                  optFunc = envOptimize[optimizerName] || optimize.optimizers[optimizerName];
                  if (!optFunc) {
                      throw new Error('optimizer with name of "' +
                                      optimizerName +
                                      '" not found for this environment');
                  }
  
                  optConfig = config[optimizerName] || {};
                  if (config.generateSourceMaps) {
                      optConfig.generateSourceMaps = !!config.generateSourceMaps;
                      optConfig._buildSourceMap = config._buildSourceMap;
                  }
  
                  try {
                      if (config.preserveLicenseComments) {
                          //Pull out any license comments for prepending after optimization.
                          try {
                              licenseContents = parse.getLicenseComments(fileName, fileContents);
                          } catch (e) {
                              throw new Error('Cannot parse file: ' + fileName + ' for comments. Skipping it. Error is:\n' + e.toString());
                          }
                      }
  
                      fileContents = licenseContents + optFunc(fileName,
                                                               fileContents,
                                                               outFileName,
                                                               keepLines,
                                                               optConfig);
                      if (optConfig._buildSourceMap && optConfig._buildSourceMap !== config._buildSourceMap) {
                          config._buildSourceMap = optConfig._buildSourceMap;
                      }
                  } catch (e) {
                      if (config.throwWhen && config.throwWhen.optimize) {
                          throw e;
                      } else {
                          logger.error(e);
                      }
                  }
              } else {
                  if (config._buildSourceMap) {
                      config._buildSourceMap = null;
                  }
              }
  
              return fileContents;
          }