# ejstpl

> compile ejs templates for use clientside as js functions

Latest version **4.0.0** (published 2015-02-13) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ejstpl
pnpm add ejstpl
yarn add ejstpl
bun add ejstpl
```

Provides the command `ejstpl`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2015-02-13 |
| First published | 2014-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+10 in 2 direct dependencies) |
| Install scripts | no |
| Author | Matt Hadley |
| Maintainers | diff_sky |
| Keywords | ejs, templates, compile, client, clientside |

## Links

- npm: https://www.npmjs.com/package/ejstpl
- Repository: https://github.com/diffsky/ejstpl
- Issues: https://github.com/diffsky/ejstpl/issues
- npm.io page: https://npm.io/package/ejstpl

## Dependencies (5)

- [ejs](https://npm.io/package/ejs.md) 2.2.4
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.0
- [globule](https://npm.io/package/globule.md) ^0.2.0
- [commander](https://npm.io/package/commander.md) ~2.6.0
- [minimatch](https://npm.io/package/minimatch.md) ^2.0.1

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2015-02-13
- 3.4.0 — 2015-01-12
- 3.3.0 — 2014-06-27
- 3.2.0 — 2014-06-27
- 3.1.0 — 2014-06-27
- 3.0.0 — 2014-06-05
- 2.0.2 — 2014-06-04
- 2.0.1 — 2014-05-27
- 1.3.2 — 2014-05-24
- 1.3.1 — 2014-05-24
- 1.3.0 — 2014-05-17
- 1.2.1 — 2014-05-17
- 1.2.0 — 2014-03-18
- 1.1.0 — 2014-03-06
- 1.0.0 — 2014-03-02
- … 7 more at https://npm.io/package/ejstpl/versions

## README

# ejstpl [![](https://travis-ci.org/diffsky/ejstpl.svg)](https://travis-ci.org/diffsky/ejstpl)

Compile [ejs templates](https://github.com/visionmedia/ejs) for use serverside and clientside.

## Breaking Change in 4.0.0

version `4.0.0` uses ejs `2.0.0` which is not backwards compatible with lower versions.
See https://github.com/diffsky/ejstpl/issues/1 for more detail.


## Install

### Globally

```
[sudo] npm -g i ejstpl
```

### In a project

```
npm i ejstpl --save[-dev]
```

## Usage

### On the command line

```
  Usage: ejstpl [options]

  Options:

    -h, --help          output usage information
    -V, --version       output the version number
    -i, --input [glob]  glob string to find .ejs files
    -c, --cwd [dir]     directory to start globbing from
    -o, --output [dir]  directory to output compiled js files
    -v, --verbose       send progress to stdout
```

### Programatically

```
var ejstpl = require('ejstpl');

// To compile templates to the filesystem:
ejstpl({
  cwd: <path to input dir>,
  output: <path to output dir>
})

By default ejstpl will glob for and compile `**/*.ejs` in the specified `cwd`. To
Glob for a different pattern, pass in a `input` property.

// To get an object with all the compiled templates for use serverside, omit the output option:
var templates = ejstpl({
  cwd: <path to input dir>
})
console.log(templates['foo']({data: 'hello'})
```

### Clientside

When compiled for clientside use, ejstpl is designed to be used with [`dist/ejstpl.js`](https://raw.githubusercontent.com/diffsky/ejstpl/master/dist/ejstpl.js) for the ejs lib to use clientside.

Compiled templates can be rendered in the browser via:

```
ejs.tpl('templateName', opts);  // where opts is the data to be rendered
```

All compiled templates are in the `ejs.tplc` template cache.

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