keystonejs / keystone-classic

Node.js CMS and web app framework
http://v4.keystonejs.com
MIT License
14.65k stars 2.21k forks source link

Does keystone js support nunjucks for email templates? Nunjucks is my default view template for keystone and is working fine with cons, I am using cons with nunjucks for regular views. I can't get nunjucks to work for email templates, I just get an error or an email with the template file path in the body, not content. Could not load engine (cons.nunjucks). Please make sure you have installed the package in your project. Error: Could not load engine (cons.nunjucks). Please make sure you have installed the package in your project. #4945

Closed jelordreygulle closed 4 years ago

jelordreygulle commented 4 years ago

Does keystone js support nunjucks for email templates? Nunjucks is my default view template for keystone and is working fine with cons, I am using cons with nunjucks for regular views. I can't get nunjucks to work for email templates, I just get an error or an email with the template file path in the body, not content. Could not load engine (cons.nunjucks). Please make sure you have installed the package in your project. Error: Could not load engine (cons.nunjucks). Please make sure you have installed the package in your project.

Code

var sendEmail = function(err, results) {
        if (err) return callback(err);
        async.each(results.admins, function(admin, done) {
            new Email('notification.html', { transport: 'mailgun', engine: 'cons.nunjucks', root: 'templates/emails' }).send({
                apiKey: '344rtefdsfbf4fg8',
                domain: '34324s33fdfdfd',
                // admin: admin.firstname,
                // author: results.author ? results.author.name.full : 'Somebody',
                // title: post.title,
                // keystoneURL: 'http://www.sydjs.com/keystone/post/' + post.id,
                // host: 'http://www.sydjs.com',
            }, {
                subject: 'Test Email',
                to: 'jelordreygulle@gmail.com',
                from: {
                    name: 'Test Mail',
                    email: 'contact@sydjs.com'
                }
            }, done);
        }, callback);
    }