# ejs-json

> for ejs+json ==》 html

Latest version **1.0.4** (published 2018-08-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install ejs-json
pnpm add ejs-json
yarn add ejs-json
bun add ejs-json
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-08-24 |
| First published | 2018-08-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 19 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | yueziyao |

## Links

- npm: https://www.npmjs.com/package/ejs-json
- Repository: https://github.com/yueziyao/ejs-json
- Homepage: https://github.com/yueziyao/ejs-json#readme
- Issues: https://github.com/yueziyao/ejs-json/issues
- npm.io page: https://npm.io/package/ejs-json

## Dependencies (6)

- [ejs](https://npm.io/package/ejs.md) 2.5.9
- [path](https://npm.io/package/path.md) ^0.12.7
- [through2](https://npm.io/package/through2.md) 2.0.3
- [replace-ext](https://npm.io/package/replace-ext.md) ^1.0.0
- [safe-buffer](https://npm.io/package/safe-buffer.md) ^5.0.1
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.0

## Recent versions

- 1.0.4 (latest) — 2018-08-24
- 1.0.3 — 2018-08-24
- 1.0.2 — 2018-08-24
- 1.0.1 — 2018-08-23
- 1.0.0 — 2018-08-23

## README

# ejs-json

> ejs、data plugin for [gulp](https://github.com/wearefractal/gulp)

## Usage

First, install `ejs-json` as a development dependency:

```shell
npm install --save-dev ejs-json
```
second,ready your html and data file like this:

```
-src
---index.html
---index.json
---header.ejs
```
`index.html` include `header.ejs`,using `index.json`.

Then, add it to your `gulpfile.js`:

```javascript
var ejs = require("ejs-json")

//compile ejs
gulp.task('compile-ejs', function () {
    return gulp.src('./src/*.html')
        .pipe(ejs({"data":"./src/data"}))
        .pipe(gulp.dest("./dist"))
});
```
This plugin will auto loading the json in your data url,like "./src/data".

if you has more files and datas , they will auto compiles , too.

## API

### ejs(data, options, settings)

#### data
Type: `url`
Default: `{"data":url}`

```
//use like
ejs({"data":"./src/data"})
```

#### options
Type: `hash`
Default: `{}`

A hash object for ejs options.

For more info on `ejs` options, check the [project's documentation](https://github.com/mde/ejs).

#### settings
Type: `hash`
Default: `{}`

A hash object to configure the plugin.

##### settings.ext
Type: `String`
Default: `undefined`

Defines the file extension that will be appended to the filename. If no extension is provided, the same extension of the input file will be used.

**Note:** As of `v2.0.0` the output file extension is no longer `.html` by default, you need to specify it, otherwise it will have the same extension of the input file.

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