How to use the consolidate.ejs function in consolidate

To help you get started, we’ve selected a few consolidate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wesleytodd / nighthawk / example / react / index.js View on Github external
require('babel-register')
var app = require('express')()
var serveStatic = require('serve-static')
var ejs = require('consolidate').ejs
var routes = require('./routes')

app.engine('html', ejs)
app.set('view engine', 'html')
app.set('views', '.')

// Register routes
routes(app)

// Serve static assets
app.use('/static', serveStatic('.'))

// Start server
app.listen('1234', function () {
  console.log('Listening on 1234')
})
github wesleytodd / nighthawk / example / basic / server.js View on Github external
var app = require('express')();
var serveStatic = require('serve-static');
var ejs = require('consolidate').ejs;
var routes = require('./routes');

app.engine('html', ejs);
app.set('view engine', 'html');
app.set('views', 'templates');

// Register routes on child app
routes(app);

// Serve static assets on base app
app.use('/static', serveStatic('.'));

// Start server
app.listen('1234', function () {
	console.log('Listening on 1234');
});
github twolfson / twolfson.com / server / index.js View on Github external
registerViewEngine: function () {
    // Set up view engine and static files for pages
    var app = this.app;
    app.engine('ejs', ejsEngine);
    app.engine('jade', jadeEngine);
    app.set('view engine', 'ejs');
    app.set('views', __dirname + '/views');
    app.use('/public', express['static'](__dirname + '/../dist'));
    app.use('/public', express['static'](__dirname + '/../public'));
    app.use(expressPartials());
  },
  addRoutes: function () {
github wongcyrus / AWSCloudLab / AWSCloudLabCore / endLabStackLambda.js View on Github external
context.labStorageSnapshotId = undefined;
        }
        if (course.share.find(x => x === "labMaterialSnapshotId")) {
            context.labMaterialSnapshotId = course.labMaterialSnapshotId;
            context.labMaterialSnapshotUrl = `https://${region}.console.aws.amazon.com/ec2/v2/home?region=${region}#Snapshots:visibility=private;search=${context.labMaterialSnapshotId}`;
        }
        if (course.share.find(x => x === "imageId")) {
            context.imageId = course.imageId;
            context.imageIdUrl = `https://${region}.console.aws.amazon.com/ec2/v2/home?region=${region}1#Images:visibility=private-images;search=${context.imageId}`;
        }

        if (course.share.find(x => x === "endLabAmi")) {
            context.endLabImageIdUrl = `https://${region}.console.aws.amazon.com/ec2/v2/home?region=${region}#Images:visibility=private-images;imageId=${context.endLabAmi}`;
        }

        cons.ejs(__dirname + '/template/endLabEmail.ejs', context)
            .then((template) => {
                context.emailBody = template;
                resolve(context);
            })
            .catch((err) => {
                reject(err);
            });
    });
github wongcyrus / AWSCloudLab / AWSCloudLabCore / emailloginLambda.js View on Github external
let bindTemplate = context => new Promise((resolve, reject) => {
        let emailContext = context;
        emailContext.signInUrl = `https://${awsAccountId}.signin.aws.amazon.com/console`;
        emailContext.instanceInUrl = `https://${region}.console.aws.amazon.com/ec2/v2/home?region=${region}#Instances:instanceId=${emailContext.id};sort=instanceId`;

        cons.ejs(__dirname + '/template/userEmail.ejs', emailContext)
            .then((template) => {
                emailContext.emailBody = template;
                resolve(emailContext);
            })
            .catch((err) => {
                reject(err);
            });
    });
github wongcyrus / AWSCloudLab / AWSCloudLabCore / lib / CloudformationManager.js View on Github external
return new Promise((resolve, reject) => {
            console.log('Create bindBackupCfnTemplate');
            cons.ejs('template/backupLabStorage.yaml', context)
                .then(template => {
                    resolve(template);
                })
                .catch(err => {
                    reject(err);
                });
        });
    }
github wildbit / postmark-cli / src / commands / templates / PreviewCommand.ts View on Github external
app.get('/:alias', (req, res) => {
      const templates = this.compileTemplatesFromFolder(directory);
      const template: any = find(templates, { Alias: req.params.alias });

      consolidate.ejs(
        this.previewTemplate,
        { template: template },
        (err, html) => {
          if (err) res.send(err);
          return res.send(html)
        }
      )
    });
github wongcyrus / AWSCloudLab / AWSCloudLabCore / lib / CloudformationManager.js View on Github external
return new Promise((resolve, reject) => {
            cons.ejs(path, context)
                .then(template => {
                    resolve("" + template);
                })
                .catch(err => {
                    reject(err);
                });
        });
    }
github wildbit / postmark-cli / src / commands / templates / preview.ts View on Github external
app.get('/', (req, res) => {
    manifest = createManifest(templatesdirectory)
    const templates = filter(manifest, { TemplateType: 'Standard' })
    const layouts = filter(manifest, { TemplateType: 'Layout' })
    const path = untildify(templatesdirectory).replace(/\/$/, '')

    consolidate.ejs(
      `${previewPath}index.ejs`,
      { templates, layouts, path },
      (err, html) => renderTemplateContents(res, err, html)
    )
  })
github wildbit / postmark-cli / src / commands / templates / PreviewCommand.ts View on Github external
app.get('/', (req, res) => {
      const templates = this.compileTemplatesFromFolder(directory);

      consolidate.ejs(
        this.previewRoot,
        {
          templates: filter(templates, { TemplateType: 'Standard' }),
          layouts: filter(templates, { TemplateType: 'Layout' }),
          path: this.fileUtils.directoryFullPath(directory),
        },
        (err, html) => {
          if (err) res.send(err);
          return res.send(html);
        }
      )
    });

consolidate

Modern and maintained fork of the template engine consolidation library. Maintained and supported by Forward Email <https://forwardemail.net>, the 100% open-source and privacy-focused email service.

MIT
Latest version published 8 months ago

Package Health Score

79 / 100
Full package analysis