jest-nunjucks

1.0.0 • Public • Published

Build Status

jest-nunjucks

Jest processor that compiles nunjucks templates

Install

npm i jest-nunjucks --save-dev

Config example

Add to your config

"jest": {
    "transform": {
        "^.+\\.njk$": "jest-nunjucks",
    }
}

To use nunjucks configuration options just add them into global jest config

"jest": {
  "globals": {
    "nunjucks": {
      "config": {
        "throwOnUndefined": true,
        "trimBlocks": true
      }
    }
  },
  "transform": {
    "^.+\\.njk$": "jest-nunjucks"
  }
}

To use set path to look for templates use root option, it will be resolved with jest <rootDir>. If it's unset path for templates will be - <rootDir>;

"jest": {
  "globals": {
    "nunjucks": {
      "root": "./path-to-root-dir",
      "config": {
        "throwOnUndefined": true,
        "trimBlocks": true
      }
    }
  },
  "transform": {
    "^.+\\.njk$": "jest-nunjucks"
  }
}

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i jest-nunjucks

Weekly Downloads

91

Version

1.0.0

License

MIT

Unpacked Size

5.35 kB

Total Files

14

Last publish

Collaborators

  • denar90