可以在类似于 css 的 html 文件中包含 `templates` 吗? [英] can one include `templates` in a html file similar to css?

查看:21
本文介绍了可以在类似于 css 的 html 文件中包含 `templates` 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 html templates.在代码方面,很难为每个 html 文件保留正确的模板集.

是否有可能有一个模板文件,就像一个 css 文件,它包含在 html 的 head 部分 文件?

例如,为了补充head中的style部分,可以链接到样式表,例如

<前><link rel="stylesheet" type="text/css" href="mystyle.css" >

我的应用程序使用了多个 模板 集合.它们可以像样式表一样处理,即链接到单独的文件中,还是每个 template 定义都需要直接成为原始 html 文件的一部分?

解决方案

假设我们想在一个名为 templates.html