fix(email): document post-queue render path and tighten guard
This commit is contained in:
+11
-4
@@ -9,13 +9,20 @@ const files = fs.readdirSync(dir).filter((f) => f.endsWith('.html'));
|
||||
const failures = [];
|
||||
for (const f of files) {
|
||||
const src = fs.readFileSync(path.join(dir, f), 'utf8');
|
||||
const trimmed = src.trim();
|
||||
const checks = [
|
||||
[/IMPORT emails\/partials\/header\.(html|tpl)/, 'missing header IMPORT'],
|
||||
[/IMPORT emails\/partials\/footer\.(html|tpl)/, 'missing footer IMPORT'],
|
||||
[
|
||||
trimmed.startsWith('<!-- IMPORT emails/partials/header.html -->'),
|
||||
'header IMPORT must be first',
|
||||
],
|
||||
[
|
||||
trimmed.endsWith('<!-- IMPORT emails/partials/footer.html -->'),
|
||||
'footer IMPORT must be last',
|
||||
],
|
||||
[/<!-- preheader -->/, 'missing preheader marker'],
|
||||
];
|
||||
for (const [re, msg] of checks) {
|
||||
if (!re.test(src)) failures.push(`${f}: ${msg}`);
|
||||
for (const [check, msg] of checks) {
|
||||
if (check instanceof RegExp ? !check.test(src) : !check) failures.push(`${f}: ${msg}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user