Use more structured yaml for examples source path
This commit is contained in:
@@ -6,7 +6,7 @@ docs: >
|
|||||||
Move a map to a seperate window.
|
Move a map to a seperate window.
|
||||||
tags: "external, window"
|
tags: "external, window"
|
||||||
sources:
|
sources:
|
||||||
- resources/external-map-map.html
|
- path: resources/external-map-map.html
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<input id="external-map-button" type="button" value="Open external map"></input>
|
<input id="external-map-button" type="button" value="Open external map"></input>
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ docs: >
|
|||||||
tags: "worker, offscreencanvas, vector-tiles"
|
tags: "worker, offscreencanvas, vector-tiles"
|
||||||
experimental: true
|
experimental: true
|
||||||
sources:
|
sources:
|
||||||
- offscreen-canvas.worker.js as worker.js
|
- path: offscreen-canvas.worker.js
|
||||||
|
as: worker.js
|
||||||
cloak:
|
cloak:
|
||||||
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Get your own API key at https://www.maptiler.com/cloud/
|
value: Get your own API key at https://www.maptiler.com/cloud/
|
||||||
|
|||||||
@@ -314,9 +314,8 @@ export default class ExampleBuilder {
|
|||||||
let jsSources = jsSource;
|
let jsSources = jsSource;
|
||||||
if (data.sources) {
|
if (data.sources) {
|
||||||
data.extraSources = await Promise.all(
|
data.extraSources = await Promise.all(
|
||||||
data.sources.map(async (fileName) => {
|
data.sources.map(async (sourceConfig) => {
|
||||||
const as = fileName.split(/ +as +/);
|
const fileName = sourceConfig.path;
|
||||||
fileName = as[0];
|
|
||||||
const extraSourcePath = path.join(data.dir, fileName);
|
const extraSourcePath = path.join(data.dir, fileName);
|
||||||
let source = await fse.readFile(extraSourcePath, readOptions);
|
let source = await fse.readFile(extraSourcePath, readOptions);
|
||||||
let ext = fileName.match(/\.(\w+)$/)[1];
|
let ext = fileName.match(/\.(\w+)$/)[1];
|
||||||
@@ -330,7 +329,7 @@ export default class ExampleBuilder {
|
|||||||
source = this.cloakSource(source, data.cloak);
|
source = this.cloakSource(source, data.cloak);
|
||||||
assets[fileName] = source;
|
assets[fileName] = source;
|
||||||
return {
|
return {
|
||||||
name: as[1] || fileName,
|
name: sourceConfig.as ?? fileName,
|
||||||
source: source,
|
source: source,
|
||||||
type: ext,
|
type: ext,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user