Add ids to layers in themes

This commit is contained in:
Pieter Vander Vennet 2021-09-26 19:59:51 +02:00
parent 39166ff806
commit 0ca19a5a03
10 changed files with 95 additions and 60 deletions

View file

@ -14,6 +14,10 @@ import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
* In place fix
*/
function fixLayerConfig(config: LayerConfigJson) : void{
if(config.tagRenderings === undefined){
return
}
for (const tagRendering of config.tagRenderings) {
if(tagRendering["#"] !== undefined){
tagRendering["id"] = tagRendering["#"]
@ -32,7 +36,7 @@ for (const layerFile of layerFiles) {
fixLayerConfig(layerFile.parsed)
writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, " "))
}
/*
const themeFiles = ScriptUtils.getThemeFiles()
for (const themeFile of themeFiles) {
for (const layerConfig of themeFile.parsed.layers ?? []) {
@ -42,6 +46,6 @@ for (const themeFile of themeFiles) {
// @ts-ignore
fixLayerConfig(layerConfig)
}
// writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " "))
writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " "))
}
//*/