Open irgipaulius opened 4 years ago
I don't really understand how grunt works, so my workaround:
Added a script in package.json
:
"push-postmark": "npm run build && node ./removeHTML.js && npm run deploy"
In /Gruntfile.js
edit the deploy
task:
grunt.registerTask('deploy', ['shell:postmarkPush']) // remove 'default' task
Create removeHTML.js
file in root and insert:
const pathToTemplates = "./dist/postmark-templates"
const files = fs.readdirSync(pathToTemplates);
files.forEach(directory => {
const templateDir = path.join(pathToTemplates, directory)
const metaFile = JSON.parse(fs.readFileSync(path.join(templateDir, 'meta.json'), 'utf8'));
if (!metaFile.LayoutTemplate){
// if LayoutTemplate is not set, then delete the HTML content
fs.unlinkSync(path.join(templateDir, 'content.html'))
}
});
Run npm run push-postmark
Now if template hasn't got LayoutTemplate
set, mailmason will push only the text version to postmarkapp.
It would be great to have this feature by default.
I know I am not supposed to ask use-case questions here as described here, but I am having no success elsewhere, plus if there is no answer to my question, this could become a feature request.
Currently, in mailmason a template with no Layout set, fills both HTML and Text versions of the email template in postmarkapp.
How do I create a template in mailmason so the
HTML
field in postmark will be empty, andText
set?That is important for creating small size ticket emails without bloating customer service management service.