forked from MapComplete/MapComplete
chore: fix linting error
This commit is contained in:
parent
833704e25d
commit
78f06a0d35
36 changed files with 51 additions and 43 deletions
|
@ -37,15 +37,23 @@ function genImages(dryrun = false) {
|
|||
const name = path.substring(0, path.length - 4).replace(/[ -]/g, "_")
|
||||
|
||||
const nameUC = name.toUpperCase().at(0) + name.substring(1)
|
||||
|
||||
const svgBody = svg
|
||||
.replace(
|
||||
"<svg ",
|
||||
"<svg {...$$$$restProps} on:click on:mouseover on:mouseenter on:mouseleave on:keydown on:focus ",
|
||||
)
|
||||
.replace(/\\"/g, "\"")
|
||||
.replace(/(rgb\(0%,0%,0%\)|#000000|#000)/g, "{color}")
|
||||
|
||||
const hasColor = svgBody.indexOf("{color}") >= 0
|
||||
|
||||
const svelteCode =
|
||||
'<script>\nexport let color = "#000000"\n</script>\n' +
|
||||
svg
|
||||
.replace(
|
||||
"<svg ",
|
||||
"<svg {...$$$$restProps} on:click on:mouseover on:mouseenter on:mouseleave on:keydown on:focus "
|
||||
)
|
||||
.replace(/\\"/g, '"')
|
||||
.replace(/(rgb\(0%,0%,0%\)|#000000|#000)/g, "{color}")
|
||||
["<script>",
|
||||
"export " + (hasColor ? "let" : "const") + " color = \"#000000\"",
|
||||
"</script>",
|
||||
svgBody].join("\n")
|
||||
|
||||
fs.writeFileSync("./src/assets/svg/" + nameUC + ".svelte", svelteCode, "utf8")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue