[TOC]
# 安裝
## Npm
```bash
npm install art-template --save
```
## 在瀏覽器中實時編譯
下載:[template-web.js](https://unpkg.com/art-template/lib/template-web.js)(gzip: 6kb)
**兼容**
IE8+(IE8 需要補丁才能運行。[示例](https://github.com/aui/art-template/blob/master/example/web-ie-compatible/index.html))
**差異**
因為瀏覽器不支持文件系統,所以 `template(filename, data)` 不支持傳入文件路徑,它內部使用 `document.getElementById(filename).innerHTML` 來獲取模板,例如:
```html
<script src="lib/template-web.js"></script>
<script id="tpl-user" type="text/html">
{{if user}}
<h2>{{user.name}}</h2>
{{/if}}
</script>
```
## 在瀏覽器中預編譯
使用 Webpack 的 Loader: [art-template-loader](../webpack)。
## 插件
* Webpack: [art-template-loader](../webpack)
* Express: [express-art-template](../express)
* Koa: [koa-art-template](../koa)