src/index.js
function replaceTplTag(dirFromPublicPath, tag, replacements, templateFileLog) {
	let tagPath = tag.replace(new RegExp(tplTagPathRegExpStr), '$1');
	let tagPathFromPublicPath = path.posix.resolve(dirFromPublicPath, tagPath);
	if (
		tagPathFromPublicPath in replacements
		&&
		replacements.hasOwnProperty(tagPathFromPublicPath)
	) {
		let result = (
			path.posix.isAbsolute(tagPath)
				? replacements[tagPathFromPublicPath]
				: path.posix.relative(
					dirFromPublicPath,
					replacements[tagPathFromPublicPath]
				)
		);
		templateFileLog.addTemplateTagLog(tag, result);
		return result;
	}
	templateFileLog.addTemplateTagLog(tag);
	return tag;
}
function replaceTplTag(dirFromPublicPath, tag, replacements, templateFileLog) {
	let tagPath = tag.replace(new RegExp(tplTagPathRegExpStr), '$1');
	let tagPathFromPublicPath = path.posix.resolve(dirFromPublicPath, tagPath);
	if (
		tagPathFromPublicPath in replacements
		&&
		replacements.hasOwnProperty(tagPathFromPublicPath)
	) {
		let result = (
			path.posix.isAbsolute(tagPath)
				? replacements[tagPathFromPublicPath]
				: path.posix.relative(
					dirFromPublicPath,
					replacements[tagPathFromPublicPath]
				)
		);
		templateFileLog.addTemplateTagLog(tag, result);
		return result;
	}
	templateFileLog.addTemplateTagLog(tag);
	return tag;
}
function replaceTplTag ( dirFromPublicPath , tag , replacements , templateFileLog ) { let tagPath = tag . replace ( new RegExp ( tplTagPathRegExpStr ) , '$1' ) ; let tagPathFromPublicPath = path . posix . resolve ( dirFromPublicPath , tagPath ) ; if ( tagPathFromPublicPath in replacements && replacements . hasOwnProperty ( tagPathFromPublicPath ) ) { let result = ( path . posix . isAbsolute ( tagPath ) ? replacements [ tagPathFromPublicPath ] : path . posix . relative ( dirFromPublicPath , replacements [ tagPathFromPublicPath ] ) ) ; templateFileLog . addTemplateTagLog ( tag , result ) ; return result ; } templateFileLog . addTemplateTagLog ( tag ) ; return tag ; }
Replace a template tag.

@param  {string} dirFromPublicPath The directory of the file that contains the template tag.
@param  {string} tag               The template tag.
@param  {Object} replacements      The replacements.
@param  {Object} templateFileLog   The template file log.

@return {string}                   The replaced (or original) template tag.
Replace a template tag .