Skip to content

Commit 39d5336

Browse files
committed
use regex to match bloom editors current idea of what a problematic css looks like
1 parent 5a77017 commit 39d5336

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

custom-css-analysis-and-migration/filter-stylesheets.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ const count = records.reduce((acc, record) => acc + record.paths.length, 0);
1515
console.write(`total books with custom css rules: ${count}\r\n`);
1616
console.write(`total unique css files: ${records.length}\r\n`);
1717

18+
const kProbablyWillInterfere = `\\.marginBox\\s*\\{[^\\}]*?(?<![-\\w])(padding-|left:|top:|right:|bottom:|margin-|width:|height:)[^\\}]*\\}`;
19+
const kProbablyWillInterfereRegex = new RegExp(kProbablyWillInterfere, "gi");
20+
1821
const filteredRecords = records.filter((record) => {
19-
return record.content.includes("left") || record.content.includes("width");
22+
return kProbablyWillInterfereRegex.test(record.content);
2023
});
2124

2225
// in filteredRecords.paths, we want to remove any path that has the same filename as another path

0 commit comments

Comments
 (0)