yosssi/ace 基于 html/template 包实现的模版引擎,模版风格类似Markdown,还能缓存渲染结果。
ace 示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
= doctype html
html lang=en
head
title Hello Ace
= css
h1 { color: blue; }
body
h1 {{.Msg}}
#container.wrapper
p..
Ace is an HTML template engine for Go.
This engine simplifies HTML coding in Go web application development.
= javascript
console.log('Welcome to Ace');
输出是这样:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello Ace</title>
<style type="text/css">
h1 { color: blue; }
</style>
</head>
<body>
<h1>Hello Ace</h1>
<div id="container" class="wrapper">
<p>
Ace is an HTML template engine for Go.<br>
This engine simplifies HTML coding in Go web application development.
</p>
</div>
<script type="text/javascript">
console.log('Welcome to Ace');
</script>
</body>
</html>
yosssi/ace 项目地址 https://github.com/yosssi/ace
本文网址: https://golangnote.com/topic/19.html 转摘请注明来源