1.2.1 • Published 6 years ago

@atlas.js/templates v1.2.1

Weekly downloads
1
License
BSD-3-Clause
Repository
github
Last release
6 years ago

@atlas.js/templates

This package contains an action which allows rendering a template language into the resulting html string. This is ideal for rendering email templates or simple web views into final html.

The rendering is done using consolidate.js - all template languages listed there are supported by this action - you only need to install the template package you wish to use.

Usage

Make sure you install the template package you want to use.

import { Atlas } from '@atlas.js/atlas'
import { Action as Templates } from '@atlas.js/templates'

const atlas = new Atlas({
  config: {
    actions: {
      templates: {
        engine: 'pug',
        templates: 'path/to/templates',
        extension: '.pug',
      },
    },
  },
})
atlas.action('templates', Templates)
await atlas.start()

// Render a template file located in the folder you specified via `templates` in the config and use
// the second argument as the locals for the template
const html = await atlas.actions.templates.render('password-reset', { user: 'abc', code: '123456' })

License

See the LICENSE file for information.

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.1.0-alpha.7

6 years ago

1.1.0-alpha.6

6 years ago

1.1.0-alpha.5

6 years ago

1.1.0-alpha.4

7 years ago

1.1.0-alpha.3

7 years ago

1.1.0-alpha.2

7 years ago

1.1.0-alpha.1

7 years ago

1.1.0-alpha.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.3

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago