Closed katp4 closed 5 years ago
You can use custom fonts in your css.
includes/style.css
@font-face {
font-family: 'Roboto';
src: url('../../../assets/fonts/Roboto.otf') format('opentype')
}
body {
font-family: 'Roboto', Arial, Helvetica, sans-serif;
}
And in your html file html.pug
head
style
include includes/style.css
@katp4 here you go:
App example:
const path = require('path');
const customFonts = require('custom-fonts-in-emails');
const Email = require('email-templates');
(async () => {
try {
const header = await customFonts.png2x({
text: 'Make something people want',
fontNameOrPath: 'GoudyBookletter1911',
fontColor: 'white',
backgroundColor: '#ff6600',
fontSize: 40
});
const email = new Email();
await email.send({
template: 'some-template',
message: {
to: 'elon@spacex.com'
},
locals: {
name: 'Elon',
header
}
});
} catch (err) {
throw err;
}
))();
Template
some-template.pug
:
!= header
p Welcome to Mars, the red planet.
a bit late but thanks guys!
Hello,
I'm trying to add custom fonts to my emails. I've included the .otf files in my directory, i've installed custom-fonts-in-emails but the only thing mentioned in the documentation is to add it to my config.locals which is very vague.
Could you be able to add more documentation or at least an example on how to do that?
Thanks