# gulp-thymeleaf

> Thymeleaf plugin for gulp

Latest version **0.1.3** (published 2018-07-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-thymeleaf
pnpm add gulp-thymeleaf
yarn add gulp-thymeleaf
bun add gulp-thymeleaf
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2018-07-04 |
| First published | 2018-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kanon Kakuno |
| Maintainers | yadex205 |
| Keywords | gulp, gulpplugin, thymeleaf |

## Links

- npm: https://www.npmjs.com/package/gulp-thymeleaf
- npm.io page: https://npm.io/package/gulp-thymeleaf

## Dependencies (4)

- [through2](https://npm.io/package/through2.md) ^2.0.3
- [fancy-log](https://npm.io/package/fancy-log.md) ^1.3.2
- [thymeleaf](https://npm.io/package/thymeleaf.md) ^0.12.0
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.1

## Recent versions

- 0.1.3 (latest) — 2018-07-04
- 0.1.2 — 2018-07-04
- 0.1.1 — 2018-07-04
- 0.1.0 — 2018-07-04

## README

gulp-thymeleaf
==============

Thymeleaf plugin for gulp


Install
-------

```bash
$ npm install --save-dev gulp-thymeleaf
```


Example
-------

Give only context for template

```js
const gulp = require('gulp');
const thymeleaf = require('gulp-thymeleaf');

gulp.task('html', function() {
  gulp.src('./src/**/*.html')
      .pipe(thymeleaf({ userName: 'Chuck Norris' }))
      .pipe(gulp.dest('./build'))
})
```

Give context and options for template

```js
const fs   = require('fs')
const gulp = require('gulp');
const thymeleaf = require('gulp-thymeleaf');

gulp.task('html', function() {
  gulp.src('./src/**/*.html')
      .pipe(thymeleaf({ userName: 'Chuck Norris' },
                      { templateResolver: name => fs.readFileSync(`templates/${name}.html`) }))
      .pipe(gulp.dest('./build'))
})
```

Give only options for template

```js
const fs   = require('fs')
const gulp = require('gulp');
const thymeleaf = require('gulp-thymeleaf');

gulp.task('html', function() {
  gulp.src('./src/**/*.html')
      .pipe(thymeleaf({}, { templateResolver: name => fs.readFileSync(`templates/${name}.html`) }))
      .pipe(gulp.dest('./build'))
})
```


API
---

### thymeleaf(context, options)

#### context

Type: `Hash` Default: `{}`


#### options

Type: `Hash` Default: `thymeleaf.Thymeleaf.STANDARD_CONFIGURATION`

Given `options` will override `STANDARD_CONFIGURATION`.

See [available options](https://www.npmjs.com/package/thymeleaf#new-templateengineoptions)
on ThymeleafJS document.


Note
----

* Default options are based on `STANDARD_CONFIGURATION` which makes prefix `th` (NOT `thjs`).

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