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