List common html reference tags in one file [closed]

こ雲淡風輕ζ 提交于 2019-12-08 14:06:35

问题


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).


回答1:


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

<link rel="import" href="myfile.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.



来源:https://stackoverflow.com/questions/50221796/list-common-html-reference-tags-in-one-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!