在哪里保持HTML模板? [英] Where to keep html templates?

查看:142
本文介绍了在哪里保持HTML模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个单页的应用程序。目前,我的模板存储在index.html中,例如。

 < script id =buttontype =text / html> 
< a class =buttonhref =#id =$ {id}>
$ {value}
< / a>
< / script>

以这种方式存储它们是否是最佳做法?
我发现 jQuery的模板 - 我在哪里应该把它们<? / a>但没有可接受的答案。 你做得对。有没有必要不必要的复杂性添加到一个单页的应用程序,根据 KISS原则


如果保持简单而不是复杂,大多数系统工作得最好;因此简单性应该是设计中的关键目标,应该避免不必要的复杂性。


I have a single page app. Currently my templates stored in index.html e.g.

 <script id="button" type="text/html">
    <a class="button" href="#" id="${id}">
       ${value}
    </a>
 </script>

Is it a best practice to store them in such way? I've found jQuery templates - where should I put them? but there is no acceptable answer.

解决方案

You are doing it right. There is no need to add unnecessary complexity to a single-page app, according to the KISS principle:

Most systems work best if they are kept simple rather than made complex; therefore simplicity should be a key goal in design and unnecessary complexity should be avoided.

这篇关于在哪里保持HTML模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆