# nunjucks-async-loader

> Asynchronous loader templates nunjucks

Latest version **2.1.3** (published 2024-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install nunjucks-async-loader
pnpm add nunjucks-async-loader
yarn add nunjucks-async-loader
bun add nunjucks-async-loader
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.3 |
| Published | 2024-03-28 |
| First published | 2016-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 18 |
| Dependencies | 1 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Pavel Koltyshev |
| Maintainers | pkolt |
| Keywords | express, nunjucks, template, loader |

## Links

- npm: https://www.npmjs.com/package/nunjucks-async-loader
- Repository: https://github.com/pkolt/nunjucks-async-loader
- Homepage: https://github.com/pkolt/nunjucks-async-loader#readme
- Issues: https://github.com/pkolt/nunjucks-async-loader/issues
- npm.io page: https://npm.io/package/nunjucks-async-loader

## Dependencies (1)

- [chokidar](https://npm.io/package/chokidar.md) ^3.6.0

## Recent versions

- 2.1.3 (latest) — 2024-03-28
- 2.0.0-0 (next) — 2023-04-26
- 2.1.2 — 2023-07-11
- 2.1.1 — 2023-06-15
- 2.1.0 — 2023-06-15
- 2.0.1 — 2023-06-12
- 2.0.0 — 2023-04-29
- 1.1.5 — 2020-04-02
- 1.1.4 — 2016-04-28
- 1.1.2 — 2016-04-28
- 1.1.1 — 2016-04-23
- 1.1.0 — 2016-04-23
- 1.0.0 — 2016-04-19
- 0.1.2 — 2016-04-16
- 0.1.0 — 2016-04-16

## README

# nunjucks-async-loader ![](https://github.com/pkolt/nunjucks-async-loader/workflows/main/badge.svg)

Asynchronous loader templates [nunjucks](http://mozilla.github.io/nunjucks/).

Supports ESM modules 👍

## Why You Need?

  [nunjucks.FileSystemLoader](https://mozilla.github.io/nunjucks/api.html#filesystemloader) loads templates synchronously.
  See this [issue](https://github.com/mozilla/nunjucks/issues/726).

## Installation

```bash
$ npm i nunjucks-async-loader
```

## Usage

```typescript
import express from 'express';
import nunjucks from 'nunjucks';
import { FileSystemAsyncLoader } from 'nunjucks-async-loader';

const app = express();
const isDev = app.get('env') === 'development';

const loader = new FileSystemAsyncLoader('views', {
    watch: isDev, // (default: false) reload templates when they are changed.
    noCache: isDev // (default: false) never use a cache and recompile templates each time.
});

const env = new nunjucks.Environment(loader);

env.express(app);


app.get('/', function(req, res) {
    res.render('index.html');
});

app.listen(3000);
```

## TypeScript

If you're having trouble importing a module into TypeScript, try adding settings to `tsconfig.json`:

```json
{
    "compilerOptions": {
      "esModuleInterop": true,
      "allowSyntheticDefaultImports": true
    }
  }
```

## Tests

  To run the test suite, first install the dependencies, then run `npm test`:

```bash
$ npm ci
$ npm test
```

## License

  [MIT](LICENSE.md)

---
_Source: https://npm.io/package/nunjucks-async-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
