builder/build.js
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);
    }
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);
    }
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 ) ; }
Substitute build vars in scripts
Substitute build vars in scripts