This package has been deprecated

Author message:

This package has been deprecated. Use '@mjstahl/boring' instead.

@mjstahl/jtml

0.2.1 • Public • Published

jtml

Templating engine using JavaScript's tagged template literals.

Installation

$ npm install --save @mjstahl/jtml

Usage

Express

After installing the jtml package, we set the location of the views and the engine Express will use to render those views.

  app.set('views', './views')
  app.set('view engine', 'jtml')

Next create a file named index.jtml in the ./views directory with the following content:

<html>
  <head>
    <title>${title}</title>
  </head>
  <body>
    <h1>${message}</h1>
  </body>
</html>

Now we can configure a route that will render the index.jtml file.

  app.get('/', (req, res) => {
    res.render('index', {
      title: 'Your first JTML template',
      message: 'Looking good!'
    })
  })

Package Sidebar

Install

npm i @mjstahl/jtml

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

3.98 kB

Total Files

5

Last publish

Collaborators

  • mjstahl