mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-11-20 11:36:24 +01:00
Throw error if no replacements were made
This commit is contained in:
parent
f2b4f2e069
commit
c0fb8a2c77
@ -26,6 +26,9 @@ module.exports.buildColorizedSVG = function (svgLocation, primaryColor, secondar
|
|||||||
const svgCode = fs.readFileSync(svgLocation, { encoding: "utf8"});
|
const svgCode = fs.readFileSync(svgLocation, { encoding: "utf8"});
|
||||||
let coloredSVGCode = svgCode.replaceAll("#ff00ff", primaryColor);
|
let coloredSVGCode = svgCode.replaceAll("#ff00ff", primaryColor);
|
||||||
coloredSVGCode = coloredSVGCode.replaceAll("#00ffff", secondaryColor);
|
coloredSVGCode = coloredSVGCode.replaceAll("#00ffff", secondaryColor);
|
||||||
|
if (svgCode === coloredSVGCode) {
|
||||||
|
throw new Error("svg-colorizer made no color replacements! The input svg should only contain colors #ff00ff (primary, case-sensitive) and #00ffff (secondary, case-sensitive).");
|
||||||
|
}
|
||||||
const fileName = svgLocation.match(/.+\/(.+\.svg)/)[1];
|
const fileName = svgLocation.match(/.+\/(.+\.svg)/)[1];
|
||||||
const outputPath = path.resolve(__dirname, "../../.tmp");
|
const outputPath = path.resolve(__dirname, "../../.tmp");
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user