build/build.js
function bundleFiles(files, copy, version) {
    var node = new SourceNode(null, null, null, '');

    node.add(new SourceNode(null, null, null, copy + '(function (window, document, undefined) {'));

    for (var i = 0, len = files.length; i < len; i++) {
        var contents = fs.readFileSync(files[i], 'utf8');

        if (files[i] === 'src/Leaflet.draw.js') {
            contents = contents.replace(
                new RegExp('drawVersion = \'.*\''),
                'drawVersion = ' + JSON.stringify(version)
            );
        }

        var lines = contents.split('\n');
        var lineCount = lines.length;
        var fileNode = new SourceNode(null, null, null, '');

        fileNode.setSourceContent(files[i], contents);

        for (var j = 0; j < lineCount; j++) {
            fileNode.add(new SourceNode(j + 1, 0, files[i], lines[j] + '\n'));
        }
        node.add(fileNode);

        node.add(new SourceNode(null, null, null, '\n\n'));
    }

    node.add(new SourceNode(null, null, null, '}(window, document));'));

    var bundle = node.toStringWithSourceMap();
    return {
        src: bundle.code,
        srcmap: bundle.map.toString()
    };
}
function bundleFiles(files, copy, version) {
    var node = new SourceNode(null, null, null, '');

    node.add(new SourceNode(null, null, null, copy + '(function (window, document, undefined) {'));

    for (var i = 0, len = files.length; i < len; i++) {
        var contents = fs.readFileSync(files[i], 'utf8');

        if (files[i] === 'src/Leaflet.draw.js') {
            contents = contents.replace(
                new RegExp('drawVersion = \'.*\''),
                'drawVersion = ' + JSON.stringify(version)
            );
        }

        var lines = contents.split('\n');
        var lineCount = lines.length;
        var fileNode = new SourceNode(null, null, null, '');

        fileNode.setSourceContent(files[i], contents);

        for (var j = 0; j < lineCount; j++) {
            fileNode.add(new SourceNode(j + 1, 0, files[i], lines[j] + '\n'));
        }
        node.add(fileNode);

        node.add(new SourceNode(null, null, null, '\n\n'));
    }

    node.add(new SourceNode(null, null, null, '}(window, document));'));

    var bundle = node.toStringWithSourceMap();
    return {
        src: bundle.code,
        srcmap: bundle.map.toString()
    };
}
function bundleFiles ( files , copy , version ) { var node = new SourceNode ( null , null , null , '' ) ; node . add ( new SourceNode ( null , null , null , copy + '(function (window, document, undefined) {' ) ) ; for ( var i = 0 , len = files . length ; i < len ; i ++ ) { var contents = fs . readFileSync ( files [ i ] , 'utf8' ) ; if ( files [ i ] === 'src/Leaflet.draw.js' ) { contents = contents . replace ( new RegExp ( 'drawVersion = \'.*\'' ) , 'drawVersion = ' + JSON . stringify ( version ) ) ; } var lines = contents . split ( '\n' ) ; var lineCount = lines . length ; var fileNode = new SourceNode ( null , null , null , '' ) ; fileNode . setSourceContent ( files [ i ] , contents ) ; for ( var j = 0 ; j < lineCount ; j ++ ) { fileNode . add ( new SourceNode ( j + 1 , 0 , files [ i ] , lines [ j ] + '\n' ) ) ; } node . add ( fileNode ) ; node . add ( new SourceNode ( null , null , null , '\n\n' ) ) ; } node . add ( new SourceNode ( null , null , null , '}(window, document));' ) ) ; var bundle = node . toStringWithSourceMap ( ) ; return { src : bundle . code , srcmap : bundle . map . toString ( ) } ; }
Concatenate the files while building up a sourcemap for the concatenation, and replace the line defining L.version with the string prepared in the jakefile
Concatenate the files while building up a sourcemap for the concatenation and replace the line defining L . version with the string prepared in the jakefile