From bed6874db1645ac90d132c0f5b06eeee4970f3fb Mon Sep 17 00:00:00 2001 From: Derek Rushforth Date: Thu, 11 Jun 2020 17:07:36 -0700 Subject: [PATCH] Insert preheaders on Postmark layouts --- Gruntfile.js | 10 ++++++++++ dist/postmark-layouts/basic-full/content.html | 1 + dist/postmark-layouts/basic/content.html | 1 + dist/postmark-layouts/plain/content.html | 1 + src/layouts/basic-full/content.hbs | 1 + src/layouts/basic/content.hbs | 1 + src/layouts/plain/content.hbs | 1 + 7 files changed, 16 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 2ce66ed..68b8917 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -257,6 +257,15 @@ module.exports = function(grunt) { ], }, + // Insert mustachio syntax on Postmark layout preheaders + postmarkPreheader: { + src: [`${path.dist}postmark-layouts/**/content.hbs`], + overwrite: true, + replacements: [ + { from: /({{)(.?pm:preheader.?)(}})/g, to: '\\{{#preheader}}\\{{.}}\\{{/preheader}}' }, + ], + }, + // Remove handlebars config postmarkConfig: { src: [`${path.dist}postmark-templates/**/content.hbs`], @@ -412,6 +421,7 @@ module.exports = function(grunt) { 'copy:postmarkLayouts', // Copy Handlebars layouts to dist folder 'replace:postmarkPlaceholder', // Replace handlebars {{body}} with Postmark content placeholder 'replace:postmarkConfig', // Remove handlebars config from layouts + 'replace:postmarkPreheader', // Insert mustachio syntax on Postmark layout preheaders 'assemble:postmark', // Compile handlebars templates and layouts. Mainly used for loading partials into the templates. 'inline:postmark', // Load external CSS into layouts 'replace:styleBlock', // Add properties to style block diff --git a/dist/postmark-layouts/basic-full/content.html b/dist/postmark-layouts/basic-full/content.html index 7eb6ca1..ecbe15a 100644 --- a/dist/postmark-layouts/basic-full/content.html +++ b/dist/postmark-layouts/basic-full/content.html @@ -436,6 +436,7 @@ + {{#preheader}}{{.}}{{/preheader}}