Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denar90/jest-nunjucks
Jest processor that compiles nunjucks templates
https://github.com/denar90/jest-nunjucks
Last synced: about 2 months ago
JSON representation
Jest processor that compiles nunjucks templates
- Host: GitHub
- URL: https://github.com/denar90/jest-nunjucks
- Owner: denar90
- License: mit
- Created: 2018-08-26T19:33:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-15T13:04:03.000Z (about 6 years ago)
- Last Synced: 2024-05-19T14:31:21.390Z (7 months ago)
- Language: JavaScript
- Size: 64.5 KB
- Stars: 2
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-jest - jest-nunjucks
README
[![Build Status](https://travis-ci.org/denar90/jest-nunjucks.svg?branch=master)](https://travis-ci.org/denar90/jest-nunjucks)
# jest-nunjucks
## Jest processor that compiles nunjucks templates
### Install
`npm i jest-nunjucks --save-dev`
### Config example
Add to your config
```json
"jest": {
"transform": {
"^.+\\.njk$": "jest-nunjucks",
}
}
```To use [nunjucks configuration options](https://mozilla.github.io/nunjucks/api.html#configure) just add them into global jest config
```json
"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 ``.
If it's unset path for templates will be - ``;```json
"jest": {
"globals": {
"nunjucks": {
"root": "./path-to-root-dir",
"config": {
"throwOnUndefined": true,
"trimBlocks": true
}
}
},
"transform": {
"^.+\\.njk$": "jest-nunjucks"
}
}
```## License
MIT