# btljs

> A bigpipe template language, enhanced by jsdom, support es6 generator function

Latest version **0.0.2** (published 2015-07-06) · MIT license · 0 weekly downloads

## Install

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

## 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.0.2 |
| Published | 2015-07-06 |
| First published | 2015-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Qiaosen Huang |
| Maintainers | joesonw |
| Keywords | bigpiple, template |

## Links

- npm: https://www.npmjs.com/package/btljs
- Repository: https://github.com/joesonw/node-btl
- Homepage: https://github.com/joesonw/node-btl#readme
- Issues: https://github.com/joesonw/node-btl/issues
- npm.io page: https://npm.io/package/btljs

## Dependencies (5)

- [co](https://npm.io/package/co.md) ^4.5.4
- [co-fs](https://npm.io/package/co-fs.md) ^1.2.0
- [jsdom](https://npm.io/package/jsdom.md) ^3.1.2
- [deepcopy](https://npm.io/package/deepcopy.md) ^0.5.0
- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2015-07-06
- 0.0.1 — 2015-07-04

## README

##Description

This is a template language aimed for bigpipe with async support

Template is parsed line by line.

No more messed-up&splitted-everywhere modules needed.

Write bigpipe in pure html

##Example

###Template

```html
<!doctype html>
<html>
	<head>
		<title>Hello World</title>
	</head>
	<body>
		asdljaksdjaslk
		<img src="https://dn-cnode.qbox.me/FtG0YVgQ6iginiLpf9W4_ShjiLfU"/>
		<script wait>
			var that = this;
			this.axios.get('https://apiv2-test.517.today/public/region').then(function(response) {
				that.$regions = response.data.data;
				that.fulfill();
			}).catch(function(err) {
				throw err;
			})
		</script>>
		<for start="0" end="{{=this.regions.length}}">
			<p>{{=this.regions[this.i].name}}</p>
		</for>	
		<load src="./sub.html"></load>
	</body>
</html>
```

###NodeJs

```js
	var koa 	= require('koa');
	var fs		= require('fs');
	var Parser  = require('./lib/parser');
	var co 		= require('co');
	var app 	= koa();
	var html 	= fs.readFileSync('you file');

	var parser 	= Parser();

	co(function*() {
		yield parser.load(html);
		app.use(function* () {
			this.type = 'html';
			this.body = parser.stream();
		});
	});
	
	app.listen(3000);

```

##Customization

###Add custom tag

```js

parser.addTag('MyTag',function* (ele,push,context) {
	push('<p>This is a test tag</p>');
});

```

##Contribution Notes

If you are implementing a new tag, please put it under `./lib/tags` folder

If it extends existing html tag, name the file like `script-wait.js`

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