在一个文件中列出常见的html参考标记 [英] List common html reference tags in one file

查看:94
本文介绍了在一个文件中列出常见的html参考标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以将多个网页(AngularJS,Font,JQuery,脚本,Google Analytics等)所需的<link><script>参考元素存储在一个文件中,然后导入该文件放入我所有的HTML文件中(例如,我可以在某个位置更改文件,并且由于我的所有页面都引用了该文件,因此它将更新所有这些页面).

I am wondering if there is a way to store <link> or <script> reference elements required for multiple web pages(AngularJS, Fonts, JQuery, Scripts, Google Analytics, Etc.) in a file and then import that file into all of my HTML files(e.g. I can change a file in some place and since it is referenced in all of my pages it will update all of those pages).

推荐答案

使用 HTML导入将支持该用例,但目前处于草稿阶段.

Using HTML Imports would support this use case, but it is currently in the draft phase.

<link rel="import" href="myfile.html">

如果您对使用此功能感兴趣,现在有支持它的polyfills.提到的另一种选择是使用模板系统在请求页面时甚至在构建时将必要的依赖项添加到HTML.

If you're interested in using this functionality now there are polyfills that support it. Another option that has been mentioned is to use a template system to add the necessary dependencies to the HTML when the page is requested, or even at build time.

这篇关于在一个文件中列出常见的html参考标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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