mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
[Templates] Add template paths
...with text! prefix
This commit is contained in:
parent
930fed83e8
commit
f2e4b01721
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user