[Templates] Add template paths

...with text! prefix
This commit is contained in:
Victor Woeltjen 2016-02-26 12:50:28 -08:00
parent 930fed83e8
commit f2e4b01721

View File

@ -46,12 +46,25 @@ function findTemplateURLs(sourceCode) {
});
}
function injectRequireArgument(sourceCode, templateUrls) {
var lines = sourceCode.split('\n'),
index;
templateUrls = _.uniq(templateUrls);
index = lines.map(_.trim).indexOf("'legacyRegistry'");
lines = lines.slice(0, index).concat(templateUrls.map(function (url) {
return " \"text!./res/" + url + "\",";
}).concat(lines.slice(index)));
return lines.join('\n');
}
function migrate(file) {
var sourceCode = fs.readFileSync(file, 'utf8'),
templateUrls = findTemplateURLs(sourceCode);
templateUrls.forEach(function (templateUrl) {
console.log(templateUrl, toTemplateName(templateUrl));
});
console.log(injectRequireArgument(sourceCode, templateUrls));
}
glob('platform/**/bundle.js', {}, function (err, files) {