From ff0ad9054aca0f4df236a8dafaff4ad0bbec7956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 20 Mar 2024 12:28:22 +0100 Subject: [PATCH] Add helper script to convert the SVG icon files into a Vue components --- .../assets/icons/helpers/convertSvgToVue.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 frontend/src/assets/icons/helpers/convertSvgToVue.js diff --git a/frontend/src/assets/icons/helpers/convertSvgToVue.js b/frontend/src/assets/icons/helpers/convertSvgToVue.js new file mode 100644 index 000000000..d92ba2f7d --- /dev/null +++ b/frontend/src/assets/icons/helpers/convertSvgToVue.js @@ -0,0 +1,24 @@ +// usage: +// put source files in folder 'svgs' +// folder 'svgComponents' have to exist +// call script with command 'node convertSvgToVue.js' +// delete source files or whole folder +// run 'lint --fix' afterwards + +import { readdirSync, readFileSync, writeFileSync } from 'fs' +import { join, parse } from 'path' + +const inputDir = '../svgs' +const outputDir = '../svgComponents' + +readdirSync(inputDir).forEach((file) => { + const filePath = join(inputDir, file) + const fileName = parse(file).name + // eslint-disable-next-line security/detect-non-literal-fs-filename + const content = readFileSync(filePath, 'utf8') + const vueComponent = `\n\n\n\n\n` + + const outputFilePath = join(outputDir, `${fileName}.vue`) + // eslint-disable-next-line security/detect-non-literal-fs-filename + writeFileSync(outputFilePath, vueComponent) +})