Minify SVG in generated JS

This commit is contained in:
redphx 2024-09-02 14:57:03 +07:00
parent 4888c399f0
commit 9f46eca956

View File

@ -35,6 +35,13 @@ const postProcess = (str: string): string => {
// Add ADDITIONAL CODE block
str = str.replace('var DEFAULT_FLAGS', '\n/* ADDITIONAL CODE */\n\nvar DEFAULT_FLAGS');
// Minify SVG
str = str.replaceAll(/= "(<svg.*)";/g, function(match) {
match = match.replaceAll(/\\n*\s*/g, '');
return match;
});
assert(str.includes('/* ADDITIONAL CODE */'));
assert(str.includes('window.BX_EXPOSED = BxExposed'));
assert(str.includes('window.BxEvent = BxEvent'));