var buildMoldsSelector = require('./build-molds-selector');

module.exports = function fillMold(raw, fillers, alias) {

	var moldsSelector = buildMoldsSelector(alias);
	var moldSelected;

	while(moldSelected = moldsSelector.exec(raw)) {
		raw = raw.replace(
			new RegExp(moldSelected[0], 'g'),
			fillers[moldSelected[1]]
		);
	}
	return raw;

};

var buildMoldsSelector = require('./build-molds-selector');

module.exports = function fillMold(raw, fillers, alias) {

	var filled;
	var moldsSelector = buildMoldsSelector(alias);
	var moldSelected;

	while(moldSelected = moldsSelector.exec(raw)) {
		filled = raw.replace(moldSelected[0], fillers[moldSelected[1]]);
	}
	if(!filled) return raw;
	return filled;

};

--- 
+++ 
@@ -2,14 +2,15 @@
 
 module.exports = function fillMold(raw, fillers, alias) {
 
-	var filled;
 	var moldsSelector = buildMoldsSelector(alias);
 	var moldSelected;
 
 	while(moldSelected = moldsSelector.exec(raw)) {
-		filled = raw.replace(moldSelected[0], fillers[moldSelected[1]]);
+		raw = raw.replace(
+			new RegExp(moldSelected[0], 'g'),
+			fillers[moldSelected[1]]
+		);
 	}
-	if(!filled) return raw;
-	return filled;
+	return raw;
 
 };
Add support of multiple molds per raw
