Skip to content
프로젝트

yanhaijing/template.js has 1,317 GitHub stars and 479 forks. GitHot measured 0 stars in 24 hours and +1 in 7 days. Last checked 2026-11-14 13:01 UTC. Last push 2025-03-16.

이 수치를 측정하는 방법

What you can do

  • Native JS syntax, template parsing, compilation, and rendering
  • Supports all browsers and Node, supports TypeScript
  • Precompilation supports mainstream packaging tools
  • Custom configurations, decorators, and functions

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

소개

A javascript template engine, simple, easy & extras, support webpack, rspack, vite, rollup, esbuild, parcel, browserify, fis and gulp.

웹 및 앱

README.md

Original

template.js

license CI

English | 简体中文

A javascript template engine that is simple, easy to use, and supports webpack, rspack, vite, esbuild, rollup, parcel, browserify, fis, and gulp.

Features

  • Native JS syntax, template parsing, compilation, and rendering
  • Supports all browsers and Node, supports TypeScript
  • Precompilation supports mainstream packaging tools
  • Custom configurations, decorators, and functions
  • Data filtering support
  • Exception capture functionality
  • Subtemplates
  • Sandbox mode
  • Supports JIT and AOT compilation modes
  • Provides CLI integrated tools
  • Provides support for editor plugins

User Guide

template.js is a better way than concatenating strings, Click to use codesandbox for a quick demo

Template example

<ul>
    <%for(var i = 0; i < list.length; i++) {%>
        <li><%:=list[i].name%></li>
    <%}%>
</ul>

Data example

const data = {
  list: [{ name: 'yan' }, { name: 'haijing' }],
};

Render output

<ul>
  <li>yan</li>
  <li>haijing</li>
</ul>

Editor plugins supported by template.js

Editor Plugin
Vscode highlight plugin
Sublime highlight plugin
Atom highlight plugin
WebStorm TODO

Quickly initialize a project using CLI tools

$ npx @templatejs/cli new myapp
# Choose the corresponding platform
# ❯ webpack
#   rspack
#   vite
#   rollup
#   esbuild
#   parcel2
#   parcel1
#   fis3
#   browserify
#   gulp
#   browser

If you already have a project, you can choose a corresponding plugin, template.js supports different usage methods

Platform Plugin
webpack / rspack template-loader
vite / rollup rollup-plugin-templatejs
esbuild esbuild-plugin-templatejs
parcel2 parcel-transformer-template
parcel1 parcel-plugin-template
fis fis-parser-template
browserify browserify-templatejs
gulp gulp-templatejs
Native web & Node.js template_js
Unsupported platforms You can write a plugin yourself, please see @templatejs/precompiler

Other packages summary

Developer Guide

This project uses lerna to manage multiple plugins. Common lerna commands are as follows, note that the npx prefix cannot be left out:

$ npx lerna init # Initialize
$ npx lerna create @templatejs/parser # Create a package
$ npx lerna add yargs --scope=@templatejs/parser # Install package dependencies
$ npx lerna list # List all packages
$ npx lerna bootstrap # Install all dependencies
$ npx lerna link # Create all soft links
$ npx lerna changed # List the packages to be updated next time when using lerna publish
$ npx lerna publish # Will tag, upload git, upload npm

Release steps, modify changelog

$ yarn lint
$ yarn build
$ yarn test
$ npx lerna publish

Release without tagging, suitable for test package.

$ yarn lint
$ yarn build
$ yarn test
$ lerna version --no-git-tag-version
$ npx lerna publish from-package --dist-tag next

Contributors List

contributors

Changelog

CHANGELOG.md

Planned Feature List

TODO.md

Who is Using

To learn about who is using this, click here.

Related Links

관련 프로젝트 살펴보기