Allow cloaking of API keys and apply to Bing keys

This commit is contained in:
Andreas Hocevar
2015-10-14 14:31:42 +02:00
parent b4061e7b35
commit 3d82da1c7e
18 changed files with 39 additions and 1 deletions

View File

@@ -83,6 +83,11 @@ function augmentExamples(files, metalsmith, done) {
throw new Error('No .js file found for ' + filename);
}
var jsSource = files[jsFilename].contents.toString();
if (file.cloak) {
for (var key in file.cloak) {
jsSource = jsSource.replace(new RegExp(key, 'g'), file.cloak[key]);
}
}
var requires = getRequires(jsSource);
file.requires = requires;
file.js = {