lib/creator.js
function replace(root, options, callback) {
	analyser.readDir(root, options, function(err, files) {
		files = _.flatten(files);
		_.each(files, function(file){ 
			fs.readFile(file, 'UTF-8', function(err, data) {
				if(err) {throw err;}
				var i, value;
				for(i=0; i<options.values.length; i++) {
					value = options.values[i];
					if(value === Object(value)) {
						for(var key in value) {
							if(value.hasOwnProperty(key)) {
								data = data.replace(new RegExp('{{'+key+'}}','g'), value[key]);
							}
						}
					}
					fs.writeFile(file, data);
				}
			});
		});	
		if(callback) {
			callback(err, files);
		}
	});
}
function replace(root, options, callback) {
	analyser.readDir(root, options, function(err, files) {
		files = _.flatten(files);
		_.each(files, function(file){ 
			fs.readFile(file, 'UTF-8', function(err, data) {
				if(err) {throw err;}
				var i, value;
				for(i=0; i<options.values.length; i++) {
					value = options.values[i];
					if(value === Object(value)) {
						for(var key in value) {
							if(value.hasOwnProperty(key)) {
								data = data.replace(new RegExp('{{'+key+'}}','g'), value[key]);
							}
						}
					}
					fs.writeFile(file, data);
				}
			});
		});	
		if(callback) {
			callback(err, files);
		}
	});
}
function replace ( root , options , callback ) { analyser . readDir ( root , options , function ( err , files ) { files = _ . flatten ( files ) ; _ . each ( files , function ( file ) { fs . readFile ( file , 'UTF-8' , function ( err , data ) { if ( err ) { throw err ; } var i , value ; for ( i = 0 ; i < options . values . length ; i ++ ) { value = options . values [ i ] ; if ( value === Object ( value ) ) { for ( var key in value ) { if ( value . hasOwnProperty ( key ) ) { data = data . replace ( new RegExp ( '{{' + key + '}}' , 'g' ) , value [ key ] ) ; } } } fs . writeFile ( file , data ) ; } } ) ; } ) ; if ( callback ) { callback ( err , files ) ; } } ) ; }
search and replace in files file
search and replace in files file