# @templatejs/parser

> template.js的模板编译器

Latest version **3.1.4** (published 2023-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @templatejs/parser
pnpm add @templatejs/parser
yarn add @templatejs/parser
bun add @templatejs/parser
```

## 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 | 3.1.4 |
| Published | 2023-11-23 |
| First published | 2019-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.0.0 |
| Dependencies | 1 |
| Unpacked size | 38.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1317 |
| Author | yanhaijing |
| Maintainers | yanhaijing |
| Keywords | template, template.js, js |

## Links

- npm: https://www.npmjs.com/package/@templatejs/parser
- Repository: https://github.com/yanhaijing/template.js
- Homepage: https://github.com/yanhaijing/template.js#readme
- Issues: https://github.com/yanhaijing/template.js/issues
- npm.io page: https://npm.io/package/@templatejs/parser

## Dependencies (1)

- [@jsmini/extend](https://npm.io/package/@jsmini/extend.md) ^0.5.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 3.1.4 (latest) — 2023-11-23
- 3.1.3-alpha.0 (next) — 2023-11-23
- 3.1.2-alpha.0 — 2023-11-23
- 3.1.0-alpha.0 — 2023-11-22
- 3.0.0-alpha.0 — 2023-11-22
- 2.4.0 — 2019-12-18
- 2.3.0 — 2019-12-15
- 2.2.1 — 2019-12-11
- 2.1.0 — 2019-11-17
- 2.0.2 — 2019-11-09
- 2.0.2-alpha.0 — 2019-11-07
- 2.0.1-alpha.0 — 2019-11-07

## README

# [parser](https://github.com/yanhaijing/template.js/blob/master/packages/parser)
[![](https://img.shields.io/badge/Powered%20by-jslib%20base-brightgreen.svg)](https://github.com/yanhaijing/jslib-base)

[template.js](https://github.com/yanhaijing/template.js)的模板编译器

## 兼容性
单元测试保证支持如下环境：

| IE   | CH   | FF   | SF   | OP   | IOS  | Android   | Node  |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ----- |
| 6+   | 29+ | 55+  | 9+   | 50+  | 9+   | 4+   | 0.10+ |

**注意：编译代码依赖ES5环境，对于ie6-8需要引入[es5-shim](http://github.com/es-shims/es5-shim/)才可以兼容，可以查看[demo/demo-global.html](./demo/demo-global.html)中的例子**

## 使用者指南

通过npm下载安装代码

```bash
$ npm install --save @templatejs/parser
```

如果你是node环境

```js
const parser = require('@templatejs/parser');

const tpl = `
<div><%=a%></div>
`;

parser.parse(tpl); // return a render string like '<div>' + a + '</div>'
```

支持的参数

```js
// sTag 开始标签
// eTag 结束标签
// escape 是否默认转移输出变量
parser.parse(tpl, {sTag: '<#', eTag: '#>', escape: true});
```

## 文档
[API](https://github.com/yanhaijing/template.js/blob/master/./doc/api.md)

## 贡献者列表

[contributors](https://github.com/yanhaijing/template.js/graphs/contributors)

## 更新日志
[CHANGELOG.md](https://github.com/yanhaijing/template.js/blob/master/TODO.md/CHANGELOG.md)

## 计划列表
[TODO.md](https://github.com/yanhaijing/template.js/blob/master/TODO.md)

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