|
1 | | -# art-template |
| 1 | +# @karinjs/art-template |
2 | 2 |
|
3 | | -[](https://npmjs.org/package/art-template) |
4 | | -[](https://npmjs.org/package/art-template) |
5 | | -[](http://nodejs.org/download/) |
6 | | -[](https://travis-ci.org/aui/art-template) |
7 | | -[](https://coveralls.io/github/aui/art-template?branch=master) |
| 3 | +[](https://npmjs.org/package/@karinjs/art-template) |
| 4 | +[](http://nodejs.org/download/) |
8 | 5 |
|
9 | | -[English document](https://goofychris.github.io/art-template/) | [中文文档](https://goofychris.github.io/art-template/zh-cn/index.html) |
| 6 | +art-template 是一个简约、超快的模板引擎。它采用作用域预声明的技术来优化模板渲染速度,从而获得接近 JavaScript 极限的运行性能,并且同时支持 NodeJS 和浏览器。 |
10 | 7 |
|
11 | | -art-template is a simple and superfast templating engine that optimizes template rendering speed by scope pre-declared technique, hence achieving runtime performance which is close to the limits of JavaScript. At the same time, it supports both NodeJS and browser. [speed test online](https://goofychris.github.io/art-template/rendering-test/). |
| 8 | +本项目是对原 art-template 的重新打包优化版本,使用 tsup 进行构建,大幅减小了包体积和依赖数量。 |
12 | 9 |
|
13 | | -art-template 是一个简约、超快的模板引擎。它采用作用域预声明的技术来优化模板渲染速度,从而获得接近 JavaScript 极限的运行性能,并且同时支持 NodeJS 和浏览器。[在线速度测试](https://goofychris.github.io/art-template/rendering-test/)。 |
| 10 | +## 特性 |
14 | 11 |
|
15 | | -[](https://goofychris.github.io/art-template/rendering-test/) |
| 12 | +1. 拥有接近 JavaScript 渲染极限的的性能 |
| 13 | +2. 调试友好:语法、运行时错误日志精确到模板所在行 |
| 14 | +3. 支持 Express、Koa、Webpack |
| 15 | +4. 支持模板继承与子模板 |
| 16 | +5. 浏览器版本仅 6KB 大小 |
| 17 | +6. 零依赖,包体积小(从原版的 8.3MB 减小到 327KB) |
| 18 | +7. 对源代码无任何修改,发布到`npm`上的所有操作均由`github actions`自动完成 |
16 | 19 |
|
17 | | -## Feature |
| 20 | +## 安装 |
18 | 21 |
|
19 | | -1. performance is close to the JavaScript rendering limits |
20 | | -2. debugging friendly. Syntax errors or runtime errors will be positioned accurately at which line of template. Support setting breakpoint in templating files (Webpack Loader) |
21 | | -3. support Express, Koa, Webpack |
22 | | -4. support template inheritance and sub template |
23 | | -5. browser version is only 6KB |
| 22 | +```bash |
| 23 | +# npm |
| 24 | +npm install @karinjs/art-template |
24 | 25 |
|
25 | | -## 特性 |
| 26 | +# yarn |
| 27 | +yarn add @karinjs/art-template |
26 | 28 |
|
27 | | -1. 拥有接近 JavaScript 渲染极限的的性能 |
28 | | -2. 调试友好:语法、运行时错误日志精确到模板所在行;支持在模板文件上打断点(Webpack Loader) |
29 | | -5. 支持 Express、Koa、Webpack |
30 | | -6. 支持模板继承与子模板 |
31 | | -7. 浏览器版本仅 6KB 大小 |
| 29 | +# pnpm |
| 30 | +pnpm add @karinjs/art-template |
| 31 | +``` |
| 32 | + |
| 33 | +## 优化对比 |
| 34 | + |
| 35 | +| 指标 | 原版 art-template | @karinjs/art-template | |
| 36 | +| -------- | ----------------- | --------------------- | |
| 37 | +| 包体积 | 8.3MB | 327KB | |
| 38 | +| 依赖数量 | 33个 | 0个 | |
| 39 | + |
| 40 | +数据来源:[pkg-size.dev/art-template](https://pkg-size.dev/art-template) |
| 41 | + |
| 42 | +## 版本更新 (2025-03-29) |
| 43 | + |
| 44 | +- 使用 tsup 重新打包 |
| 45 | +- 移除所有外部依赖 |
| 46 | +- 减小包体积 |
| 47 | +- 优化类型定义 |
| 48 | +- 升级多个依赖包版本 |
| 49 | +- 将 html-minifier 替换为 html-minifier-terser,解决高危安全警告 |
0 commit comments