code: function doSubstituteBuildVars(file, buildVars) {
          var contents = fs.readFileSync(file, FILE_ENCODING);
          contents = contents.replace(/%%build:([^%]+)%%/g, function(matched, buildVarName) {
              return buildVars[buildVarName];
          });
  
          // Now do replacements specified by build directives
          contents = contents.replace(/\/\*\s?build:replaceWith\((.*?)\)\s?\*\/.*?\*\s?build:replaceEnd\s?\*\//g, "$1");
  
          fs.writeFileSync(file, contents, FILE_ENCODING);
      }
docs: Substitute build vars in scripts