From 07fa1adfe8249fa799041c89eb5b3629a29dc068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Tue, 2 Nov 2021 22:02:23 +0100 Subject: [PATCH] Use more structured yaml for examples source path --- examples/external-map.html | 2 +- examples/offscreen-canvas.html | 3 ++- examples/webpack/example-builder.js | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/external-map.html b/examples/external-map.html index 1cf5f4c030..ed37467931 100644 --- a/examples/external-map.html +++ b/examples/external-map.html @@ -6,7 +6,7 @@ docs: > Move a map to a seperate window. tags: "external, window" sources: - - resources/external-map-map.html + - path: resources/external-map-map.html ---
diff --git a/examples/offscreen-canvas.html b/examples/offscreen-canvas.html index 7218b3a78a..c76d014fee 100644 --- a/examples/offscreen-canvas.html +++ b/examples/offscreen-canvas.html @@ -7,7 +7,8 @@ docs: > tags: "worker, offscreencanvas, vector-tiles" experimental: true sources: - - offscreen-canvas.worker.js as worker.js + - path: offscreen-canvas.worker.js + as: worker.js cloak: - key: get_your_own_D6rA4zTHduk6KOKTXzGB value: Get your own API key at https://www.maptiler.com/cloud/ diff --git a/examples/webpack/example-builder.js b/examples/webpack/example-builder.js index 55b307ab72..e2b4ffef70 100644 --- a/examples/webpack/example-builder.js +++ b/examples/webpack/example-builder.js @@ -314,9 +314,8 @@ export default class ExampleBuilder { let jsSources = jsSource; if (data.sources) { data.extraSources = await Promise.all( - data.sources.map(async (fileName) => { - const as = fileName.split(/ +as +/); - fileName = as[0]; + data.sources.map(async (sourceConfig) => { + const fileName = sourceConfig.path; const extraSourcePath = path.join(data.dir, fileName); let source = await fse.readFile(extraSourcePath, readOptions); let ext = fileName.match(/\.(\w+)$/)[1]; @@ -330,7 +329,7 @@ export default class ExampleBuilder { source = this.cloakSource(source, data.cloak); assets[fileName] = source; return { - name: as[1] || fileName, + name: sourceConfig.as ?? fileName, source: source, type: ext, };