Use pug templating engine in jsreport
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
studio
test
.DS_Store
.editorconfig
.eslintignore
.eslintrc
.gitattributes
.gitignore
.npmrc
.travis.yml
LICENSE
README.md
index.js
jsreport.config.js
package-lock.json
package.json

README.md

jsreport-pug

Build Status

Use pug templating engine in jsreport and jsreport-core

npm install jsreport-pug

You can access the input data through pug locals and you can find helpers on templateHelpers

doctype html
html(lang="en")
  head
  body
    p Hello from helper: #{templateHelpers.hello()}
    p Hello from input data: #{hello}

Guide: jsreport-cli with pug template engine instalation

  1. Create a local folder that will hold the server, i.e. (~/myTools/jsreport)
  2. Go to that directory (cd ~/myTools/jsreport)
  3. Do yarn global add jsreport-cli (you can also use npm install -g jsreport-cli)
  4. Execute jsreport init (this will create folder structure)
  5. Add this template engine or anyother (i.e. ejs) this command: yarn add jsreport-pug
  6. Start the server with this command jsreport start

When jsreport starts, it looks for engines in node_modules folder and if it founds any it loads them with no extra configuration.

See the playground example