0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-06-25 19:38:40 +00:00

small changes to single line formatting

This commit is contained in:
Víctor Losada Hernández
2026-06-24 18:44:29 +02:00
parent e554687392
commit db572c8fea
2 changed files with 261 additions and 239 deletions
@@ -29,8 +29,9 @@ export async function formatCSS(view) {
//format manually single declaration rules to span one line.
//Prettier can't do it by default, this is crude but it works
formatted = formatted.replace(
/([^{]+)\{\s*\n\s*([^;\n]+:[^;\n]+;)\s*\n\s*\}/g,
(_, selector, decl)=>`${selector.trim()} { ${decl.trim()} }`
/([^{]+)\{\s*\n\s*([^;\n]+:[^;\n]+;)\s*\n\s*\}(\s*)/g,
(_, selector, decl, whitespace) =>
`${selector} { ${decl.trim()} }${whitespace}`
);
if(formatted === code) return true;